Skip to contentSkip to conversation

endian fixes for nvmet

PATCH In review Christoph Hellwig 3 participants 6 messages Jan 28, 2025

Subsystems (2)
lore
Share & tools
lore

Christoph Hellwig

author maintainer
#0 lore raw

Hi all,

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

author maintainer
#1 lore raw

PATCH 1/2 nvmet: the result field in nvmet_alloc_ctrl_args is little endian

So use the __le32 type for it.

Fixes 6202783184bf ("nvmet: Improve nvmet_alloc_ctrl() interface and implementation")
---
 drivers/nvme/target/nvmet.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/nvmet.h +1 -1
index b540216c0c9a..4be8d22d2d8d 100644
@@ -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;
 };
Signature · 1 line
2.45.2
author maintainer
#3 lore raw

PATCH 2/2 nvmet: add a missing endianess conversion in nvmet_execute_admin_connect

In reply to Christoph Hellwig

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")
---
 drivers/nvme/target/fabrics-cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/fabrics-cmd.c +1 -1
index a7ff05b3be29..eb406c90c167 100644
@@ -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)
Signature · 1 line
2.45.2
maintainer Applied
#5 lore raw
In reply to Christoph Hellwig
Quoted 2 lines · Christoph Hellwig

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.