* [PATCH for-next] nvme: use helpers to access io_uring cmd space
@ 2024-10-18 16:16 ` Pavel Begunkov
2024-10-18 18:37 ` Jens Axboe
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Pavel Begunkov @ 2024-10-18 16:16 UTC (permalink / raw)
To: io-uring; +Cc: Jens Axboe, asml.silence, Kanchan Joshi, linux-block
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]>
---
drivers/nvme/host/ioctl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index 1d769c842fbf..6f351da7f049 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -404,7 +404,7 @@ struct nvme_uring_cmd_pdu {
static inline struct nvme_uring_cmd_pdu *nvme_uring_cmd_pdu(
struct io_uring_cmd *ioucmd)
{
- return (struct nvme_uring_cmd_pdu *)&ioucmd->pdu;
+ return io_uring_cmd_to_pdu(ioucmd, struct nvme_uring_cmd_pdu);
}
static void nvme_uring_task_cb(struct io_uring_cmd *ioucmd,
@@ -634,8 +634,6 @@ static int nvme_ns_uring_cmd(struct nvme_ns *ns, struct io_uring_cmd *ioucmd,
struct nvme_ctrl *ctrl = ns->ctrl;
int ret;
- BUILD_BUG_ON(sizeof(struct nvme_uring_cmd_pdu) > sizeof(ioucmd->pdu));
-
ret = nvme_uring_cmd_checks(issue_flags);
if (ret)
return ret;
--
2.46.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH for-next] nvme: use helpers to access io_uring cmd space
2024-10-18 16:16 ` [PATCH for-next] nvme: use helpers to access io_uring cmd space Pavel Begunkov
@ 2024-10-18 18:37 ` Jens Axboe
2024-10-18 18:43 ` Anuj gupta
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2024-10-18 18:37 UTC (permalink / raw)
To: Pavel Begunkov, io-uring; +Cc: Kanchan Joshi, linux-block
On 10/18/24 10:16 AM, Pavel Begunkov wrote:
> 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.
Reviewed-by: Jens Axboe <[email protected]>
--
Jens Axboe
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH for-next] nvme: use helpers to access io_uring cmd space
2024-10-18 16:16 ` [PATCH for-next] nvme: use helpers to access io_uring cmd space Pavel Begunkov
2024-10-18 18:37 ` Jens Axboe
@ 2024-10-18 18:43 ` Anuj gupta
2024-10-19 0:44 ` Chaitanya Kulkarni
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Anuj gupta @ 2024-10-18 18:43 UTC (permalink / raw)
To: Pavel Begunkov; +Cc: io-uring, Jens Axboe, Kanchan Joshi, linux-block
Looks good:
Reviewed-by: Anuj Gupta <[email protected]>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH for-next] nvme: use helpers to access io_uring cmd space
2024-10-18 16:16 ` [PATCH for-next] nvme: use helpers to access io_uring cmd space Pavel Begunkov
2024-10-18 18:37 ` Jens Axboe
2024-10-18 18:43 ` Anuj gupta
@ 2024-10-19 0:44 ` Chaitanya Kulkarni
2024-10-21 16:04 ` Pavel Begunkov
2024-10-21 3:53 ` Kanchan Joshi
2024-10-21 15:16 ` Keith Busch
4 siblings, 1 reply; 7+ messages in thread
From: Chaitanya Kulkarni @ 2024-10-19 0:44 UTC (permalink / raw)
To: Pavel Begunkov, [email protected]
Cc: Jens Axboe, Kanchan Joshi, [email protected],
[email protected]
+ (linux-nvme)
On 10/18/24 09:16, Pavel Begunkov wrote:
> 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]>
> ---
> drivers/nvme/host/ioctl.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
> index 1d769c842fbf..6f351da7f049 100644
> --- a/drivers/nvme/host/ioctl.c
> +++ b/drivers/nvme/host/ioctl.c
> @@ -404,7 +404,7 @@ struct nvme_uring_cmd_pdu {
> static inline struct nvme_uring_cmd_pdu *nvme_uring_cmd_pdu(
> struct io_uring_cmd *ioucmd)
> {
> - return (struct nvme_uring_cmd_pdu *)&ioucmd->pdu;
> + return io_uring_cmd_to_pdu(ioucmd, struct nvme_uring_cmd_pdu);
> }
>
> static void nvme_uring_task_cb(struct io_uring_cmd *ioucmd,
> @@ -634,8 +634,6 @@ static int nvme_ns_uring_cmd(struct nvme_ns *ns, struct io_uring_cmd *ioucmd,
> struct nvme_ctrl *ctrl = ns->ctrl;
> int ret;
>
> - BUILD_BUG_ON(sizeof(struct nvme_uring_cmd_pdu) > sizeof(ioucmd->pdu));
> -
> ret = nvme_uring_cmd_checks(issue_flags);
> if (ret)
> return ret;
Indeed from io_uring_cmd_private_sz_check(), Looks good.
Reviewed-by: Chaitanya Kulkarni <[email protected]>
-ck
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH for-next] nvme: use helpers to access io_uring cmd space
2024-10-18 16:16 ` [PATCH for-next] nvme: use helpers to access io_uring cmd space Pavel Begunkov
` (2 preceding siblings ...)
2024-10-19 0:44 ` Chaitanya Kulkarni
@ 2024-10-21 3:53 ` Kanchan Joshi
2024-10-21 15:16 ` Keith Busch
4 siblings, 0 replies; 7+ messages in thread
From: Kanchan Joshi @ 2024-10-21 3:53 UTC (permalink / raw)
To: Pavel Begunkov, io-uring; +Cc: Jens Axboe, linux-block
Reviewed-by: Kanchan Joshi <[email protected]>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH for-next] nvme: use helpers to access io_uring cmd space
2024-10-18 16:16 ` [PATCH for-next] nvme: use helpers to access io_uring cmd space Pavel Begunkov
` (3 preceding siblings ...)
2024-10-21 3:53 ` Kanchan Joshi
@ 2024-10-21 15:16 ` Keith Busch
4 siblings, 0 replies; 7+ messages in thread
From: Keith Busch @ 2024-10-21 15:16 UTC (permalink / raw)
To: Pavel Begunkov; +Cc: io-uring, Jens Axboe, Kanchan Joshi, linux-block
On Fri, Oct 18, 2024 at 05:16:37PM +0100, Pavel Begunkov wrote:
> 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.
Thanks, applied to nvme-6.13.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH for-next] nvme: use helpers to access io_uring cmd space
2024-10-19 0:44 ` Chaitanya Kulkarni
@ 2024-10-21 16:04 ` Pavel Begunkov
0 siblings, 0 replies; 7+ messages in thread
From: Pavel Begunkov @ 2024-10-21 16:04 UTC (permalink / raw)
To: Chaitanya Kulkarni, [email protected]
Cc: Jens Axboe, Kanchan Joshi, [email protected],
[email protected]
On 10/19/24 01:44, Chaitanya Kulkarni wrote:
> + (linux-nvme)
My bad, lost CC nvme. Thanks for review
> On 10/18/24 09:16, Pavel Begunkov wrote:
>> 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]>
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-10-21 16:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20241018161636epcas5p43562d1c949f7e6ed0289a7ec213490ff@epcas5p4.samsung.com>
2024-10-18 16:16 ` [PATCH for-next] nvme: use helpers to access io_uring cmd space Pavel Begunkov
2024-10-18 18:37 ` Jens Axboe
2024-10-18 18:43 ` Anuj gupta
2024-10-19 0:44 ` Chaitanya Kulkarni
2024-10-21 16:04 ` Pavel Begunkov
2024-10-21 3:53 ` Kanchan Joshi
2024-10-21 15:16 ` Keith Busch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox