From: Tokunori Ikegami Date: Sun, 16 Feb 2025 06:58:04 +0000 (+0900) Subject: nvme-print-binary: fix to output phy rx eom log length X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c785a0aa8c9ab2e46653c227f3d48d821730d3c7;p=users%2Fsagi%2Fnvme-cli.git 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 --- 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); }