Skip to content

Commit d81cd5e

Browse files
ikegami-tigaw
authored andcommitted
opc: fix hardware component descriptions bytes number
Subtract offset bytes number 64 from the hardware component log size. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 454893a commit d81cd5e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

plugins/ocp/ocp-hardware-component-log.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ static int get_hwcomp_log_data(struct nvme_dev *dev, struct hwcomp_log *log)
193193
print_info_array("guid", log->guid, ARRAY_SIZE(log->guid));
194194
print_info("size: %s\n", uint128_t_to_string(le128_to_cpu(log->size)));
195195

196-
args.len = uint128_t_to_double(le128_to_cpu(log->size)) * sizeof(__le32);
196+
args.len = uint128_t_to_double(le128_to_cpu(log->size)) * sizeof(__le32) -
197+
offsetof(struct __packed hwcomp_log, desc);
197198
log->desc = calloc(1, args.len);
198199
if (!log->desc) {
199200
fprintf(stderr, "error: ocp: calloc: %s\n", strerror(errno));

0 commit comments

Comments
 (0)