linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme: fix endianness of command word prints in nvme_log_err_passthru()
@ 2025-06-30 16:21 John Garry
  2025-06-30 16:44 ` Keith Busch
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: John Garry @ 2025-06-30 16:21 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi; +Cc: linux-nvme, alan.adamson, John Garry

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>
---
build tested only

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 7493e5aa984c..551595c18791 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -381,12 +381,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 {
-- 
2.43.5



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvme: fix endianness of command word prints in nvme_log_err_passthru()
  2025-06-30 16:21 [PATCH] nvme: fix endianness of command word prints in nvme_log_err_passthru() John Garry
@ 2025-06-30 16:44 ` Keith Busch
  2025-07-01 15:51 ` alan.adamson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Keith Busch @ 2025-06-30 16:44 UTC (permalink / raw)
  To: John Garry; +Cc: axboe, hch, sagi, linux-nvme, alan.adamson

On Mon, Jun 30, 2025 at 04:21:53PM +0000, John Garry wrote:
> The command word members of struct nvme_common_command are __le32 type,
> so use helper le32_to_cpu() to read them properly.

Looks good.

Reviewed-by: Keith Busch <kbusch@kernel.org>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvme: fix endianness of command word prints in nvme_log_err_passthru()
  2025-06-30 16:21 [PATCH] nvme: fix endianness of command word prints in nvme_log_err_passthru() John Garry
  2025-06-30 16:44 ` Keith Busch
@ 2025-07-01 15:51 ` alan.adamson
  2025-07-03 11:45 ` Christoph Hellwig
  2025-07-14 13:52 ` Christoph Hellwig
  3 siblings, 0 replies; 6+ messages in thread
From: alan.adamson @ 2025-07-01 15:51 UTC (permalink / raw)
  To: John Garry, kbusch, axboe, hch, sagi; +Cc: linux-nvme

On 6/30/25 9:21 AM, John Garry wrote:
> 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>



> ---
> build tested only
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 7493e5aa984c..551595c18791 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -381,12 +381,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 {


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvme: fix endianness of command word prints in nvme_log_err_passthru()
  2025-06-30 16:21 [PATCH] nvme: fix endianness of command word prints in nvme_log_err_passthru() John Garry
  2025-06-30 16:44 ` Keith Busch
  2025-07-01 15:51 ` alan.adamson
@ 2025-07-03 11:45 ` Christoph Hellwig
  2025-07-03 11:48   ` John Garry
  2025-07-14 13:52 ` Christoph Hellwig
  3 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2025-07-03 11:45 UTC (permalink / raw)
  To: John Garry; +Cc: kbusch, axboe, hch, sagi, linux-nvme, alan.adamson

I tried to apply this to nvme-6.17, but it depend on the previous
cdw numbering fix in 6.16.  I guess we'll want to pick this up after
6.17-rc1 unless there's a need to rush it into 6.16.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvme: fix endianness of command word prints in nvme_log_err_passthru()
  2025-07-03 11:45 ` Christoph Hellwig
@ 2025-07-03 11:48   ` John Garry
  0 siblings, 0 replies; 6+ messages in thread
From: John Garry @ 2025-07-03 11:48 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: kbusch, axboe, sagi, linux-nvme, alan.adamson

On 03/07/2025 12:45, Christoph Hellwig wrote:
> I tried to apply this to nvme-6.17, but it depend on the previous
> cdw numbering fix in 6.16.  I guess we'll want to pick this up after
> 6.17-rc1 unless there's a need to rush it into 6.16.
> 

I don't think it's realy necessary for 6.16 .  I just noticed this issue 
when reviewing that cdw numbering fix (so not affecting me).


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nvme: fix endianness of command word prints in nvme_log_err_passthru()
  2025-06-30 16:21 [PATCH] nvme: fix endianness of command word prints in nvme_log_err_passthru() John Garry
                   ` (2 preceding siblings ...)
  2025-07-03 11:45 ` Christoph Hellwig
@ 2025-07-14 13:52 ` Christoph Hellwig
  3 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2025-07-14 13:52 UTC (permalink / raw)
  To: John Garry; +Cc: kbusch, axboe, hch, sagi, linux-nvme, alan.adamson

I ended up applying this to nvme-6.16 - it is a trivial fix for a
tracing path and waiting out of past 6.17-rc1 just increases the
chances it will get lost.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-14 13:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-30 16:21 [PATCH] nvme: fix endianness of command word prints in nvme_log_err_passthru() John Garry
2025-06-30 16:44 ` Keith Busch
2025-07-01 15:51 ` alan.adamson
2025-07-03 11:45 ` Christoph Hellwig
2025-07-03 11:48   ` John Garry
2025-07-14 13:52 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).