public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* endian fixes for nvmet
@ 2025-01-28  7:55 Christoph Hellwig
  2025-01-28  7:55 ` [PATCH 1/2] nvmet: the result field in nvmet_alloc_ctrl_args is little endian Christoph Hellwig
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Christoph Hellwig @ 2025-01-28  7:55 UTC (permalink / raw)
  To: Sagi Grimberg, Chaitanya Kulkarni, Keith Busch; +Cc: Damien Le Moal, linux-nvme

Hi all,

this fixes two endian issues in the nvmet code that were added as part
of adding the PCIe endpoint support.


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

* [PATCH 1/2] nvmet: the result field in nvmet_alloc_ctrl_args is little endian
  2025-01-28  7:55 endian fixes for nvmet Christoph Hellwig
@ 2025-01-28  7:55 ` Christoph Hellwig
  2025-01-28  8:02   ` Sagi Grimberg
  2025-01-28  7:55 ` [PATCH 2/2] nvmet: add a missing endianess conversion in nvmet_execute_admin_connect Christoph Hellwig
  2025-01-28 15:07 ` endian fixes for nvmet Keith Busch
  2 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2025-01-28  7:55 UTC (permalink / raw)
  To: Sagi Grimberg, Chaitanya Kulkarni, Keith Busch; +Cc: Damien Le Moal, linux-nvme

So use the __le32 type for it.

Fixes: 6202783184bf ("nvmet: Improve nvmet_alloc_ctrl() interface and implementation")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/target/nvmet.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index b540216c0c9a..4be8d22d2d8d 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -589,7 +589,7 @@ struct nvmet_alloc_ctrl_args {
 	const struct nvmet_fabrics_ops *ops;
 	struct device		*p2p_client;
 	u32			kato;
-	u32			result;
+	__le32			result;
 	u16			error_loc;
 	u16			status;
 };
-- 
2.45.2



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

* [PATCH 2/2] nvmet: add a missing endianess conversion in nvmet_execute_admin_connect
  2025-01-28  7:55 endian fixes for nvmet Christoph Hellwig
  2025-01-28  7:55 ` [PATCH 1/2] nvmet: the result field in nvmet_alloc_ctrl_args is little endian Christoph Hellwig
@ 2025-01-28  7:55 ` Christoph Hellwig
  2025-01-28  8:03   ` Sagi Grimberg
  2025-01-28 15:07 ` endian fixes for nvmet Keith Busch
  2 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2025-01-28  7:55 UTC (permalink / raw)
  To: Sagi Grimberg, Chaitanya Kulkarni, Keith Busch; +Cc: Damien Le Moal, linux-nvme

The kato field is little endian on the wire, but native endian in
the in-core structure, add the missing byte swap.

Fixes: 6202783184bf ("nvmet: Improve nvmet_alloc_ctrl() interface and implementation")
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/target/fabrics-cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c
index a7ff05b3be29..eb406c90c167 100644
--- a/drivers/nvme/target/fabrics-cmd.c
+++ b/drivers/nvme/target/fabrics-cmd.c
@@ -287,7 +287,7 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req)
 	args.subsysnqn = d->subsysnqn;
 	args.hostnqn = d->hostnqn;
 	args.hostid = &d->hostid;
-	args.kato = c->kato;
+	args.kato = le32_to_cpu(c->kato);
 
 	ctrl = nvmet_alloc_ctrl(&args);
 	if (!ctrl)
-- 
2.45.2



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

* Re: [PATCH 1/2] nvmet: the result field in nvmet_alloc_ctrl_args is little endian
  2025-01-28  7:55 ` [PATCH 1/2] nvmet: the result field in nvmet_alloc_ctrl_args is little endian Christoph Hellwig
@ 2025-01-28  8:02   ` Sagi Grimberg
  0 siblings, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2025-01-28  8:02 UTC (permalink / raw)
  To: Christoph Hellwig, Chaitanya Kulkarni, Keith Busch
  Cc: Damien Le Moal, linux-nvme

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>


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

* Re: [PATCH 2/2] nvmet: add a missing endianess conversion in nvmet_execute_admin_connect
  2025-01-28  7:55 ` [PATCH 2/2] nvmet: add a missing endianess conversion in nvmet_execute_admin_connect Christoph Hellwig
@ 2025-01-28  8:03   ` Sagi Grimberg
  0 siblings, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2025-01-28  8:03 UTC (permalink / raw)
  To: Christoph Hellwig, Chaitanya Kulkarni, Keith Busch
  Cc: Damien Le Moal, linux-nvme

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>


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

* Re: endian fixes for nvmet
  2025-01-28  7:55 endian fixes for nvmet Christoph Hellwig
  2025-01-28  7:55 ` [PATCH 1/2] nvmet: the result field in nvmet_alloc_ctrl_args is little endian Christoph Hellwig
  2025-01-28  7:55 ` [PATCH 2/2] nvmet: add a missing endianess conversion in nvmet_execute_admin_connect Christoph Hellwig
@ 2025-01-28 15:07 ` Keith Busch
  2 siblings, 0 replies; 6+ messages in thread
From: Keith Busch @ 2025-01-28 15:07 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Sagi Grimberg, Chaitanya Kulkarni, Damien Le Moal, linux-nvme

On Tue, Jan 28, 2025 at 08:55:32AM +0100, Christoph Hellwig wrote:
> this fixes two endian issues in the nvmet code that were added as part
> of adding the PCIe endpoint support.

Thanks, applied to nvme-6.14.


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

end of thread, other threads:[~2025-01-28 15:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-28  7:55 endian fixes for nvmet Christoph Hellwig
2025-01-28  7:55 ` [PATCH 1/2] nvmet: the result field in nvmet_alloc_ctrl_args is little endian Christoph Hellwig
2025-01-28  8:02   ` Sagi Grimberg
2025-01-28  7:55 ` [PATCH 2/2] nvmet: add a missing endianess conversion in nvmet_execute_admin_connect Christoph Hellwig
2025-01-28  8:03   ` Sagi Grimberg
2025-01-28 15:07 ` endian fixes for nvmet Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox