From a3a278b02827bd426eaef6f57db09926f96bf319 Mon Sep 17 00:00:00 2001 From: jeff-lien-sndk Date: Thu, 22 Jan 2026 16:50:42 -0600 Subject: [PATCH] ocp: Fix core dump during telemetry log decode When decoding ocp 2.5 telemetry log with json output the internal-log ocp plugin command was hitting an issue that caused a core dump. This commit will resolve that error. Signed-off-by: jeff-lien-sndk --- plugins/ocp/ocp-nvme.h | 2 +- plugins/ocp/ocp-telemetry-decode.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/ocp/ocp-nvme.h b/plugins/ocp/ocp-nvme.h index 2814b171aa..6a447b049e 100644 --- a/plugins/ocp/ocp-nvme.h +++ b/plugins/ocp/ocp-nvme.h @@ -11,7 +11,7 @@ #if !defined(OCP_NVME) || defined(CMD_HEADER_MULTI_READ) #define OCP_NVME -#define OCP_PLUGIN_VERSION "2.16.0" +#define OCP_PLUGIN_VERSION "3.0.0" #include "cmd.h" PLUGIN(NAME("ocp", "OCP cloud SSD extensions", OCP_PLUGIN_VERSION), diff --git a/plugins/ocp/ocp-telemetry-decode.c b/plugins/ocp/ocp-telemetry-decode.c index f51e23fbe3..f1c1e50d9a 100644 --- a/plugins/ocp/ocp-telemetry-decode.c +++ b/plugins/ocp/ocp-telemetry-decode.c @@ -1225,6 +1225,9 @@ int parse_event_fifo(unsigned int fifo_num, unsigned char *pfifo_start, (le16_to_cpu((unsigned int)pStaticSnapshotEvent->stat_data_size) * SIZE_OF_DWORD); + struct json_object *pstats_array = + ((pevent_fifos_object != NULL) ? json_create_array() : NULL); + if (pStaticSnapshotEvent != NULL && pStaticSnapshotEvent->stat_data_size > 0) { __u8 *pstatistic_entry = @@ -1234,7 +1237,7 @@ int parse_event_fifo(unsigned int fifo_num, unsigned char *pfifo_start, parse_statistic( (struct nvme_ocp_telemetry_statistic_descriptor *) pstatistic_entry, - pevent_descriptor_obj, + pstats_array, fp); } } else {