Skip to content

Commit aed273b

Browse files
author
YUEyuan310
committed
ocp-nvme: fix the error display of Hardware Component Log
The display of Hardware Component (Log Identifier C6h) failures to comply with protocol OCP2.5 Issue: #2566 Signed-off-by: YUEyuan310 <[email protected]>
1 parent 454893a commit aed273b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

plugins/ocp/ocp-print-stdout.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ static void stdout_hwcomp_log(struct hwcomp_log *log, __u32 id, bool list)
3333
struct hwcomp_desc_entry e = { log->desc };
3434

3535
long double log_size = uint128_t_to_double(le128_to_cpu(log->size)) * sizeof(__le32);
36+
size_t desc_offset = offsetof(struct hwcomp_log, desc);
3637

3738
printf("Log Identifier: 0x%02xh\n", LID_HWCOMP);
3839
printf("Log Page Version: 0x%x\n", le16_to_cpu(log->ver));
@@ -41,7 +42,7 @@ static void stdout_hwcomp_log(struct hwcomp_log *log, __u32 id, bool list)
4142
printf("Hardware Component Log Size: 0x%"PRIx64"\n", (uint64_t)log_size);
4243
print_array("Reserved48", log->rsvd48, ARRAY_SIZE(log->rsvd48));
4344
printf("Component Descriptions\n");
44-
while (log_size > 0) {
45+
while (log_size - desc_offset > 0) {
4546
e.date_lot_size = le64_to_cpu(e.desc->date_lot_size) * sizeof(__le32);
4647
e.date_lot_code = e.date_lot_size ? (__u8 *)e.desc + date_lot_code_offset : NULL;
4748
e.add_info_size = le64_to_cpu(e.desc->add_info_size) * sizeof(__le32);

0 commit comments

Comments
 (0)