]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ec: initialize lost_chunk in ErasureCodeClay 52714/head
authorCasey Bodley <cbodley@redhat.com>
Mon, 31 Jul 2023 21:01:52 +0000 (17:01 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 31 Jul 2023 21:01:56 +0000 (17:01 -0400)
[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<int, ceph::buffer::v15_2_0::list>&, std::set<int>&, std::map<int, ceph::buffer::v15_2_0::list>&, int, std::vector<std::pair<int, int> >&)’:
/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 <cbodley@redhat.com>
src/erasure-code/clay/ErasureCodeClay.cc

index 1e5a517dee8e9cff6942b9e4e7a842b26e284c66..7162cecbd9f9e25b2ddec50aaa64add62076a6a6 100644 (file)
@@ -507,7 +507,7 @@ int ErasureCodeClay::repair_one_lost_chunk(map<int, bufferlist> &recovered_data,
     }
   }
 
-  int lost_chunk;
+  int lost_chunk = 0;
   int count = 0;
   for ([[maybe_unused]] auto& [node, bl] : recovered_data) {
     lost_chunk = node;