From: Danny Al-Gaaf Date: Sat, 1 Mar 2014 12:33:18 +0000 (+0100) Subject: PGMonitor: fix uninitialized scalar variable X-Git-Tag: v0.78~108^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=754a36897b3b1454e51df40c623e216f159874cd;p=ceph.git PGMonitor: fix uninitialized scalar variable Fix type handling in dump_stuck_pg_stats. If type is type doesn't match to known PGMap::STUCK_* type print out a message and return directly from function. CID 1030132 (#2 of 2): Uninitialized scalar variable (UNINIT) uninit_use_in_call: Using uninitialized value "stuck_type" when calling "PGMap::dump_stuck(ceph::Formatter *, PGMap::StuckPG, utime_t) const" Signed-off-by: Danny Al-Gaaf --- diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 6dea1c9369b0..1c64cdc8ec5a 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1978,12 +1978,17 @@ int PGMonitor::dump_stuck_pg_stats(stringstream &ds, { PGMap::StuckPG stuck_type; string type = args[0]; + if (type == "inactive") stuck_type = PGMap::STUCK_INACTIVE; - if (type == "unclean") + else if (type == "unclean") stuck_type = PGMap::STUCK_UNCLEAN; - if (type == "stale") + else if (type == "stale") stuck_type = PGMap::STUCK_STALE; + else { + ds << "Unknown type: " << type << std::endl; + return 0; + } utime_t now(ceph_clock_now(g_ceph_context)); utime_t cutoff = now - utime_t(threshold, 0);