Skip to contentSkip to conversation

nvme: fix implicit bool to flags conversion

PATCH Applied Pavel Begunkov 8 participants 9 messages May 20, 2025 – May 21, 2025 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: fix implicit bool to flags conversion

nvme_map_user_request() takes flags as the last argument, but nvme_uring_cmd_io() shoves a bool "vec" into it. It behaves as expected because bool is converted to 0/1 and NVME_IOCTL_VEC is defined as 1, but it's better to pass flags explicitly.

Fixes 7b7fdb8e2dbc1 ("nvme: replace the "bool vec" arguments with flags in the ioctl path")
---
 drivers/nvme/host/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/ioctl.c +1 -1
index ca86d3bf7ea4..f29107d95ff2 100644
@@ -521,7 +521,7 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
 	if (d.data_len) {
 		ret = nvme_map_user_request(req, d.addr, d.data_len,
 			nvme_to_user_ptr(d.metadata), d.metadata_len,
-			map_iter, vec);
+			map_iter, vec ? NVME_IOCTL_VEC : 0);
 		if (ret)
 			goto out_free_req;
 	}
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Pavel Begunkov

nvme_map_user_request() takes flags as the last argument, but nvme_uring_cmd_io() shoves a bool "vec" into it. It behaves as expected because bool is converted to 0/1 and NVME_IOCTL_VEC is defined as 1, but it's better to pass flags explicitly.

LGTM:

Signature · 1 line
Jens Axboe
Reviewed-by on v1 1/1
#3 lore raw
In reply to Pavel Begunkov
Quoted 8 lines · Pavel Begunkov

nvme_map_user_request() takes flags as the last argument, but nvme_uring_cmd_io() shoves a bool "vec" into it. It behaves as expected because bool is converted to 0/1 and NVME_IOCTL_VEC is defined as 1, but it's better to pass flags explicitly.

Fixes 7b7fdb8e2dbc1 ("nvme: replace the "bool vec" arguments with flags in the ioctl path")

Keith had an earlier patch to fix this, but looks like the series never got merged:
https://lore.kernel.org/linux-nvme/[email protected]/
This approach also looks fine to me, but not sure if it will complicate some of the changes Keith wanted to make.

maintainer Reviewed-by
#4 lore raw
Quoted 7 lines · Caleb Sander Mateos
Quoted 6 lines · Pavel Begunkov

nvme_map_user_request() takes flags as the last argument, but nvme_uring_cmd_io() shoves a bool "vec" into it. It behaves as expected because bool is converted to 0/1 and NVME_IOCTL_VEC is defined as 1, but it's better to pass flags explicitly.

Quoted 8 lines
Quoted 2 lines
Fixes 7b7fdb8e2dbc1 ("nvme: replace the "bool vec" arguments with flags in the ioctl path")

Keith had an earlier patch to fix this, but looks like the series never got merged:
https://lore.kernel.org/linux-nvme/[email protected]/
This approach also looks fine to me, but not sure if it will complicate some of the changes Keith wanted to make.

Thanks, but no need to wait on me for this. I will revisit these cleanups someday once I can arrange for fewer distractions, which may not be any time soon.

Patch looks good to me too.

#5 lore raw
Quoted 8 lines · Keith Busch
Quoted 7 lines · Caleb Sander Mateos
Quoted 6 lines · Pavel Begunkov

nvme_map_user_request() takes flags as the last argument, but nvme_uring_cmd_io() shoves a bool "vec" into it. It behaves as expected because bool is converted to 0/1 and NVME_IOCTL_VEC is defined as 1, but it's better to pass flags explicitly.

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
Fixes 7b7fdb8e2dbc1 ("nvme: replace the "bool vec" arguments with flags in the ioctl path")

Keith had an earlier patch to fix this, but looks like the series never got merged:
https://lore.kernel.org/linux-nvme/[email protected]/
This approach also looks fine to me, but not sure if it will complicate some of the changes Keith wanted to make.

Aha, so it was caught before, that's good.

Quoted 7 lines

Thanks, but no need to wait on me for this. I will revisit these cleanups someday once I can arrange for fewer distractions, which may not be any time soon.

Patch looks good to me too.

In which case it'd make sense to take this patch, but no objection in either case.

Signature · 1 line
Pavel Begunkov
Reviewed-by on v1 1/1
#7 lore raw
In reply to Pavel Begunkov
Quoted 7 lines · Pavel Begunkov

nvme_map_user_request() takes flags as the last argument, but nvme_uring_cmd_io() shoves a bool "vec" into it. It behaves as expected because bool is converted to 0/1 and NVME_IOCTL_VEC is defined as 1, but it's better to pass flags explicitly.

Fixes 7b7fdb8e2dbc1 ("nvme: replace the "bool vec" arguments with flags in the ioctl path")

Looks good.

-ck