From: Casey Bodley Date: Mon, 31 Jul 2023 21:01:52 +0000 (-0400) Subject: ec: initialize lost_chunk in ErasureCodeClay X-Git-Tag: v19.0.0~758^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F52714%2Fhead;p=ceph.git ec: initialize lost_chunk in ErasureCodeClay [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 --- 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;