Skip to content

Commit 5e52f71

Browse files
isilencekeithbusch
authored andcommitted
nvme: use helpers to access io_uring cmd space
Command implementations shouldn't be directly looking into io_uring_cmd to carve free space. Use an io_uring helper, which will also do build time size sanitisation. Signed-off-by: Pavel Begunkov <[email protected]> Reviewed-by: Kanchan Joshi <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Reviewed-by: Anuj Gupta <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent fdad1a2 commit 5e52f71

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/nvme/host/ioctl.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ struct nvme_uring_cmd_pdu {
402402
static inline struct nvme_uring_cmd_pdu *nvme_uring_cmd_pdu(
403403
struct io_uring_cmd *ioucmd)
404404
{
405-
return (struct nvme_uring_cmd_pdu *)&ioucmd->pdu;
405+
return io_uring_cmd_to_pdu(ioucmd, struct nvme_uring_cmd_pdu);
406406
}
407407

408408
static void nvme_uring_task_cb(struct io_uring_cmd *ioucmd,
@@ -632,8 +632,6 @@ static int nvme_ns_uring_cmd(struct nvme_ns *ns, struct io_uring_cmd *ioucmd,
632632
struct nvme_ctrl *ctrl = ns->ctrl;
633633
int ret;
634634

635-
BUILD_BUG_ON(sizeof(struct nvme_uring_cmd_pdu) > sizeof(ioucmd->pdu));
636-
637635
ret = nvme_uring_cmd_checks(issue_flags);
638636
if (ret)
639637
return ret;

0 commit comments

Comments
 (0)