From: Sun Yuechi Date: Fri, 19 Jun 2026 17:13:41 +0000 (+0800) Subject: mgr/MMgrReport: default-initialize PerfCounterType members X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F69604%2Fhead;p=ceph.git mgr/MMgrReport: default-initialize PerfCounterType members readable.sh can fail decoding pre-v3 corpus objects that predate the unit field, e.g.: **** reencode of .../objects/PerfCounterType/... resulted in a different dump **** 7c7 < "unit": 36 --- > "unit": 101 For struct_v < 3 unit is never decoded and had no in-class default, so it read indeterminate memory and differed between the two ceph-dencoder processes readable.sh compares. Default it to UNIT_NONE. Also default-initialize type to PERFCOUNTER_NONE for consistency. Signed-off-by: Sun Yuechi --- diff --git a/src/messages/MMgrReport.h b/src/messages/MMgrReport.h index 71e233048ab..06d413834a9 100644 --- a/src/messages/MMgrReport.h +++ b/src/messages/MMgrReport.h @@ -32,13 +32,13 @@ public: std::string path; std::string description; std::string nick; - enum perfcounter_type_d type; + enum perfcounter_type_d type = PERFCOUNTER_NONE; // For older clients that did not send priority, pretend everything // is "useful" so that mgr plugins filtering on prio will get some // data (albeit probably more than they wanted) uint8_t priority = PerfCountersBuilder::PRIO_USEFUL; - enum unit_t unit; + enum unit_t unit = UNIT_NONE; void encode(ceph::buffer::list &bl) const {