From eb4349e78eb139824fb82991be93650aa60801f9 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Mon, 31 Jul 2023 17:01:52 -0400 Subject: [PATCH] ec: initialize lost_chunk in ErasureCodeClay MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit [346/687] Building CXX object src/erasure-code/clay/CMakeFiles/ec_clay.dir/ErasureCodeClay.cc.o In file included from /home/cbodley/ceph/src/common/dout.h:21, from /home/cbodley/ceph/src/common/debug.h:18, from /home/cbodley/ceph/src/erasure-code/clay/ErasureCodeClay.cc:22: home/cbodley/ceph/src/erasure-code/clay/ErasureCodeClay.cc: In member function ‘int ErasureCodeClay::repair_one_lost_chunk(std::map&, std::set&, std::map&, int, std::vector >&)’: /home/cbodley/ceph/src/erasure-code/clay/ErasureCodeClay.cc:620:41: warning: ‘lost_chunk’ may be used uninitialized [-Wmaybe-uninitialized] 620 | ceph_assert(y == lost_chunk / q); | ~~~~~~~~~~~^~~ /home/cbodley/ceph/src/include/ceph_assert.h:106:6: note: in definition of macro ‘ceph_assert’ 106 | ((expr) \ | ^~~~ /home/cbodley/ceph/src/erasure-code/clay/ErasureCodeClay.cc:510:7: note: ‘lost_chunk’ was declared here 510 | int lost_chunk; | ^~~~~~~~~~ Signed-off-by: Casey Bodley --- src/erasure-code/clay/ErasureCodeClay.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/erasure-code/clay/ErasureCodeClay.cc b/src/erasure-code/clay/ErasureCodeClay.cc index 1e5a517dee8e..7162cecbd9f9 100644 --- a/src/erasure-code/clay/ErasureCodeClay.cc +++ b/src/erasure-code/clay/ErasureCodeClay.cc @@ -507,7 +507,7 @@ int ErasureCodeClay::repair_one_lost_chunk(map &recovered_data, } } - int lost_chunk; + int lost_chunk = 0; int count = 0; for ([[maybe_unused]] auto& [node, bl] : recovered_data) { lost_chunk = node; -- 2.47.3