]> git.apps.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)
committerKefu Chai <kchai@redhat.com>
Mon, 12 Apr 2021 09:35:34 +0000 (17:35 +0800)
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>
src/mon/Monitor.cc
src/osd/osd_types.h

index 6126db9caa6090747b5be8168d1a7a162542c1c9..ffac8be278c1666a6fcc2cd47e4d01b8a32aa926 100644 (file)
@@ -3698,7 +3698,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 c0fe8f781c21ea6da4c04107c4d44ef21dfbb830..fe2fe7defa9a8ce2d1675750c3c567ef7a7d1b28 100644 (file)
@@ -1631,12 +1631,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;
   }