From c785a0aa8c9ab2e46653c227f3d48d821730d3c7 Mon Sep 17 00:00:00 2001 From: Tokunori Ikegami Date: Sun, 16 Feb 2025 15:58:04 +0900 Subject: [PATCH] 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 --- nvme-print-binary.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/nvme-print-binary.c b/nvme-print-binary.c index 2e9d7724..640727d4 100644 --- a/nvme-print-binary.c +++ b/nvme-print-binary.c @@ -65,14 +65,12 @@ static void binary_boot_part_log(void *bp_log, const char *devname, d_raw((unsigned char *)bp_log, size); } -static void binary_phy_rx_eom_log(struct nvme_phy_rx_eom_log *log, - __u16 controller) +static void binary_phy_rx_eom_log(struct nvme_phy_rx_eom_log *log, __u16 controller) { - size_t len; + size_t len = le16_to_cpu(log->hsize); + if (log->eomip == NVME_PHY_RX_EOM_COMPLETED) - len = log->hsize + log->dsize * log->nd; - else - len = log->hsize; + len += (size_t)le32_to_cpu(log->dsize) * le16_to_cpu(log->nd); d_raw((unsigned char *)log, len); } -- 2.50.1