From: Christoph Hellwig <hch@lst.de>
To: Xixin Liu <liuxixin@kylinos.cn>
Cc: linux-nvme@lists.infradead.org, kbusch@kernel.org,
axboe@kernel.dk, hch@lst.de, sagi@grimberg.me,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/1] nvme: zns: cap zone report nr_zones by DMA buffer size
Date: Thu, 25 Jun 2026 13:59:09 +0200 [thread overview]
Message-ID: <20260625115909.GA18766@lst.de> (raw)
In-Reply-To: <8ed1b6a33454.1782280420.git.liuxixin@kylinos.cn>
On Wed, Jun 24, 2026 at 01:53:40PM +0800, Xixin Liu wrote:
> With Partial Report (PR=1), the Number of Zones (NZ) field in the report
> header must equal the number of zone descriptors fully transferred in the
> DMA buffer (ZNS Command Set Specification Rev 1.2, section 3.4.2).
>
> nvme_ns_report_zones() does not cap the parse loop by max_in_buf derived
> from buflen. Cap nz with min3() over the device-reported count, nr_zones -
> zone_idx, and max_in_buf.
>
> Signed-off-by: Xixin Liu <liuxixin@kylinos.cn>
> ---
> drivers/nvme/host/zns.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/host/zns.c b/drivers/nvme/host/zns.c
> index 8ed1b6a33454..2a152e87bd76 100644
> --- a/drivers/nvme/host/zns.c
> +++ b/drivers/nvme/host/zns.c
> @@ -155,7 +155,8 @@ static int nvme_zone_parse_entry(struct nvme_ns *ns,
> struct blk_zone zone = { };
>
> if ((entry->zt & 0xf) != NVME_ZONE_TYPE_SEQWRITE_REQ) {
> - dev_err(ns->ctrl->device, "invalid zone type %#x\n", entry->zt);
> + dev_err(ns->ctrl->device, "invalid zone type %#x at zone %u\n",
> + entry->zt, idx);
> return -EINVAL;
> }
This looks fine, but unrelated. Please split it into a separate patch.
The rest looks good as well.
next prev parent reply other threads:[~2026-06-25 11:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 5:53 [PATCH v1 0/1] nvme: zns: cap zone report nr_zones by DMA buffer size Xixin Liu
2026-06-24 5:53 ` [PATCH v1 1/1] " Xixin Liu
2026-06-25 11:59 ` Christoph Hellwig [this message]
2026-06-25 2:00 ` [PATCH v2 0/2] " Xixin Liu
2026-06-25 2:00 ` [PATCH v2 2/2] nvme: zns: include zone index in invalid zone type error Xixin Liu
2026-06-26 4:50 ` Christoph Hellwig
2026-06-25 2:00 ` [PATCH v2 1/2] nvme: zns: cap zone report nr_zones by DMA buffer size Xixin Liu
2026-06-26 4:49 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2026-06-23 9:35 [PATCH v1 0/1] " Xixin Liu
2026-06-23 9:35 ` [PATCH v1 1/1] " Xixin Liu
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=20260625115909.GA18766@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=liuxixin@kylinos.cn \
--cc=sagi@grimberg.me \
/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