From 61b21c04f4e4519650220dd3c4737976b37268b9 Mon Sep 17 00:00:00 2001 From: Sun Yuechi Date: Sat, 20 Jun 2026 01:13:41 +0800 Subject: [PATCH] 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 --- src/messages/MMgrReport.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 { -- 2.47.3