nvme: fix implicit bool to flags conversion
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.
--- drivers/nvme/host/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/ioctl.c +1 -1
@@ -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
Quoted 4 lines · Pavel Begunkov
nvme_map_user_request()takes flags as the last argument, butnvme_uring_cmd_io()shoves a bool "vec" into it. It behaves as expected because bool is converted to 0/1 andNVME_IOCTL_VECis defined as 1, but it's better to pass flags explicitly.
LGTM:
Signature · 1 line
Jens Axboe
Looks good to me.
Quoted 8 lines · Pavel Begunkov
nvme_map_user_request()takes flags as the last argument, butnvme_uring_cmd_io()shoves a bool "vec" into it. It behaves as expected because bool is converted to 0/1 andNVME_IOCTL_VECis 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")Signed-off-by Pavel Begunkov <[email protected]>
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.
Quoted 7 lines · Caleb Sander Mateos
Quoted 6 lines · Pavel Begunkov
nvme_map_user_request()takes flags as the last argument, butnvme_uring_cmd_io()shoves a bool "vec" into it. It behaves as expected because bool is converted to 0/1 andNVME_IOCTL_VECis 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")Signed-off-by Pavel Begunkov <[email protected]>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.
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, butnvme_uring_cmd_io()shoves a bool "vec" into it. It behaves as expected because bool is converted to 0/1 andNVME_IOCTL_VECis 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")Signed-off-by Pavel Begunkov <[email protected]>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.
Reviewed-by Keith Busch <[email protected]>
In which case it'd make sense to take this patch, but no objection in either case.
Signature · 1 line
Pavel Begunkov
Quoted 7 lines · Pavel Begunkov
nvme_map_user_request()takes flags as the last argument, butnvme_uring_cmd_io()shoves a bool "vec" into it. It behaves as expected because bool is converted to 0/1 andNVME_IOCTL_VECis 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")Signed-off-by Pavel Begunkov<[email protected]>
Looks good.
-ck
Thanks,
applied to nvme-6.16.