Skip to content

Commit 21218ee

Browse files
committed
nvme-print-binary: fix to output phy rx eom log length
Previously incorrectly the log length is calculated by the LE log data. So fix to convert the value from LE to host endian for the calculation. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
1 parent a794f75 commit 21218ee

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

nvme-print-binary.c

+4-6
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,12 @@ static void binary_boot_part_log(void *bp_log, const char *devname,
6565
d_raw((unsigned char *)bp_log, size);
6666
}
6767

68-
static void binary_phy_rx_eom_log(struct nvme_phy_rx_eom_log *log,
69-
__u16 controller)
68+
static void binary_phy_rx_eom_log(struct nvme_phy_rx_eom_log *log, __u16 controller)
7069
{
71-
size_t len;
70+
size_t len = le16_to_cpu(log->hsize);
71+
7272
if (log->eomip == NVME_PHY_RX_EOM_COMPLETED)
73-
len = log->hsize + log->dsize * log->nd;
74-
else
75-
len = log->hsize;
73+
len += (size_t)le32_to_cpu(log->dsize) * le16_to_cpu(log->nd);
7674

7775
d_raw((unsigned char *)log, len);
7876
}

0 commit comments

Comments
 (0)