From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9AC5B3DDDD1 for ; Thu, 25 Jun 2026 11:59:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.95.11.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782388753; cv=none; b=uQsJrTcKQwswWDHHDCYS6qRN6GLKUiRps0qQMgm+1dBKIzoDgAHnqIEf+ggE5Qy62DUFqJyUKi81s9AHt/cjKNks0/qE1D3iAOIBiNuaFswLaQzxL5EisszeXbIn+TQcpJc8OthskoB0a/Zs/MAzINozjl+XobVvzJVsNj+yQ64= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782388753; c=relaxed/simple; bh=/b7EQj8bxZNunHG2SwgqubOE0dWY9k8xeBBhgPlYsQo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=efLHEFVhcJcIAD0Z1n5w+JgWogfJprJgIzbs6CO1KAKNbQE29mkEvcFbxDAWUZ984dJoSMjKdKDaYNtvdFvUSbAOynKca4OOZjG5KXGZWAunldnWgrf192AT7CfeM1f+W8b+dKDFMesHqUHWiYxFRDIeNtbtWx5nZNhh3MvZyd8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de; spf=pass smtp.mailfrom=lst.de; arc=none smtp.client-ip=213.95.11.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lst.de Received: by verein.lst.de (Postfix, from userid 2407) id 2896B68B05; Thu, 25 Jun 2026 13:59:10 +0200 (CEST) Date: Thu, 25 Jun 2026 13:59:09 +0200 From: Christoph Hellwig To: Xixin Liu 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 Message-ID: <20260625115909.GA18766@lst.de> References: <8ed1b6a33454.1782280420.git.liuxixin@kylinos.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8ed1b6a33454.1782280420.git.liuxixin@kylinos.cn> User-Agent: Mutt/1.5.17 (2007-11-01) 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 > --- > 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.