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 <danny.al-gaaf@bisect.de>
{
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);