]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nvme: fix endianness of command word prints in nvme_log_err_passthru()
authorJohn Garry <john.g.garry@oracle.com>
Mon, 30 Jun 2025 16:21:53 +0000 (16:21 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 24 Jul 2025 06:56:31 +0000 (08:56 +0200)
[ Upstream commit dd8e34afd6709cb2f9c0e63340f567e6c066ed8e ]

The command word members of struct nvme_common_command are __le32 type,
so use helper le32_to_cpu() to read them properly.

Fixes: 9f079dda1433 ("nvme: allow passthru cmd error logging")
Signed-off-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Alan Adamson <alan.adamson@oracle.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c

index 2ca14f2b7a0b1335f1173fec7f49e8f8dc641dc5..947488bf431442d9e7c82aaeae1a3096b862c217 100644 (file)
@@ -375,12 +375,12 @@ static void nvme_log_err_passthru(struct request *req)
                nr->status & NVME_SC_MASK,      /* Status Code */
                nr->status & NVME_STATUS_MORE ? "MORE " : "",
                nr->status & NVME_STATUS_DNR  ? "DNR "  : "",
-               nr->cmd->common.cdw10,
-               nr->cmd->common.cdw11,
-               nr->cmd->common.cdw12,
-               nr->cmd->common.cdw13,
-               nr->cmd->common.cdw14,
-               nr->cmd->common.cdw15);
+               le32_to_cpu(nr->cmd->common.cdw10),
+               le32_to_cpu(nr->cmd->common.cdw11),
+               le32_to_cpu(nr->cmd->common.cdw12),
+               le32_to_cpu(nr->cmd->common.cdw13),
+               le32_to_cpu(nr->cmd->common.cdw14),
+               le32_to_cpu(nr->cmd->common.cdw15));
 }
 
 enum nvme_disposition {