]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon,osd: always init local variable
authorKefu Chai <kchai@redhat.com>
Mon, 12 Apr 2021 09:32:59 +0000 (17:32 +0800)
committerNathan Cutler <ncutler@suse.com>
Wed, 7 Jul 2021 20:45:26 +0000 (22:45 +0200)
this change silences the warning like:

../src/mon/Monitor.cc: In member function ‘void Monitor::handle_command(MonOpRequestRef)’:
../src/mon/Monitor.cc:3703:55: warning: ‘osd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 3703 |     uint64_t seq = mgrstatmon()->get_last_osd_stat_seq(osd);
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 7c2f58ea5ec70e5606ab362e6f4cfda087cec65a)

src/mon/Monitor.cc
src/osd/osd_types.h

index 7848f9722b8e4423dacfe578c4e60c121efed178..3f2e2dc036663ac1ca1e81bf0d7a001127c51a42 100644 (file)
@@ -3690,7 +3690,7 @@ void Monitor::handle_command(MonOpRequestRef op)
     rs = ss2.str();
     r = 0;
   } else if (prefix == "osd last-stat-seq") {
-    int64_t osd;
+    int64_t osd = 0;
     cmd_getval(cmdmap, "id", osd);
     uint64_t seq = mgrstatmon()->get_last_osd_stat_seq(osd);
     if (f) {
index 4a13ffd9719a0a07bf27cc67c47fc4fdfb2b6b5f..eb213c1be2281a295fe96f34351bd0b0ded33c3a 100644 (file)
@@ -1596,12 +1596,12 @@ public:
   }
 
   int64_t get_dedup_tier() const {
-    int64_t tier_id;
+    int64_t tier_id = 0;
     opts.get(pool_opts_t::DEDUP_TIER, &tier_id);
     return tier_id;
   }
   int64_t get_dedup_cdc_chunk_size() const {
-    int64_t chunk_size;
+    int64_t chunk_size = 0;
     opts.get(pool_opts_t::DEDUP_CDC_CHUNK_SIZE, &chunk_size);
     return chunk_size;
   }