From: "Rajashekar, Revanth" <revanth.rajashekar@intel.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>,
Jonathan Derrick <jonathan.derrick@intel.com>,
linux-nvme@lists.infradead.org
Subject: Re: [PATCH v2] nvme: Check the PRINFO bit and the Metadata size before deciding the host buffer length
Date: Wed, 13 Jan 2021 09:57:18 -0700 [thread overview]
Message-ID: <2fa121b7-dc22-6913-7876-ca71249e15bf@intel.com> (raw)
In-Reply-To: <20210112183911.GB5050@lst.de>
Hi Christoph,
Thanks for reviewing.
On 1/12/2021 11:39 AM, Christoph Hellwig wrote:
>> @@ -1546,6 +1546,11 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
>> meta_len = (io.nblocks + 1) * ns->ms;
>> metadata = nvme_to_user_ptr(io.metadata);
>>
>> + if (io.control & NVME_RW_PRINFO_PRACT && ns->ms == 8) {
>> + meta_len = 0;
>> + metadata = NULL;
>> + }
>> +
> Wouldn't something like:
>
> if ((io.control & NVME_RW_PRINFO_PRACT) &&
> ns->ms == sizeof(struct t10_pi_tuple)) {
> /*
> * Protection information is stripped/inserted by the
> * controller.
> */
> if (nvme_to_user_ptr(io.metadata))
> return -EINVAL;
> meta_len = 0;
> metadata = NULL;
> } else {
> meta_len = (io.nblocks + 1) * ns->ms;
> metadata = nvme_to_user_ptr(io.metadata);
> }
>
> make a little more sense?
Yes! it definitely makes more sense.
Will send out a v3 for this patch.
Thanks!
Revanth
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
prev parent reply other threads:[~2021-01-13 16:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-12 17:29 [PATCH v2] nvme: Check the PRINFO bit and the Metadata size before deciding the host buffer length Revanth Rajashekar
2021-01-12 18:39 ` Christoph Hellwig
2021-01-13 16:57 ` Rajashekar, Revanth [this message]
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=2fa121b7-dc22-6913-7876-ca71249e15bf@intel.com \
--to=revanth.rajashekar@intel.com \
--cc=hch@lst.de \
--cc=jonathan.derrick@intel.com \
--cc=kbusch@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