From d81cd5e1e38890a89cb64a4efd58dfab0bcf556a Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Wed, 13 Nov 2024 22:34:48 +0900 Subject: [PATCH] opc: fix hardware component descriptions bytes number Subtract offset bytes number 64 from the hardware component log size. Signed-off-by: Tokunori Ikegami --- plugins/ocp/ocp-hardware-component-log.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/ocp/ocp-hardware-component-log.c b/plugins/ocp/ocp-hardware-component-log.c index 73f1452b..90b478cb 100644 --- a/plugins/ocp/ocp-hardware-component-log.c +++ b/plugins/ocp/ocp-hardware-component-log.c @@ -193,7 +193,8 @@ static int get_hwcomp_log_data(struct nvme_dev *dev, struct hwcomp_log *log) print_info_array("guid", log->guid, ARRAY_SIZE(log->guid)); print_info("size: %s\n", uint128_t_to_string(le128_to_cpu(log->size))); - args.len = uint128_t_to_double(le128_to_cpu(log->size)) * sizeof(__le32); + args.len = uint128_t_to_double(le128_to_cpu(log->size)) * sizeof(__le32) - + offsetof(struct __packed hwcomp_log, desc); log->desc = calloc(1, args.len); if (!log->desc) { fprintf(stderr, "error: ocp: calloc: %s\n", strerror(errno)); -- 2.50.1