From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Pavel Begunkov <asml.silence@gmail.com>,
"io-uring@vger.kernel.org" <io-uring@vger.kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Kanchan Joshi <joshi.k@samsung.com>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>
Subject: Re: [PATCH for-next] nvme: use helpers to access io_uring cmd space
Date: Sat, 19 Oct 2024 00:44:38 +0000 [thread overview]
Message-ID: <b82b36c3-5ab5-4e99-941b-b099020d1b36@nvidia.com> (raw)
In-Reply-To: <c274d35f441c649f0b725c70f681ec63774fce3b.1729265044.git.asml.silence@gmail.com>
+ (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 <asml.silence@gmail.com>
> ---
> 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 <kch@nvidia.com>
-ck
next parent reply other threads:[~2024-10-19 0:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <c274d35f441c649f0b725c70f681ec63774fce3b.1729265044.git.asml.silence@gmail.com>
2024-10-19 0:44 ` Chaitanya Kulkarni [this message]
2024-10-21 16:04 ` [PATCH for-next] nvme: use helpers to access io_uring cmd space Pavel Begunkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b82b36c3-5ab5-4e99-941b-b099020d1b36@nvidia.com \
--to=chaitanyak@nvidia.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=joshi.k@samsung.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox