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 001231E7C08 for ; Wed, 3 Dec 2025 06:10:49 +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=1764742251; cv=none; b=RAkLzT+vv7bdiy57EuftlBvpGN7a4DIdlpdrK8P2eQwMdYsEC5O7CfOEY0HD1v0AC9puIcHRykefDu3PQOBhFYf9WE77YMAvNYGONCzvb4WLkvttYa8GufWEym+aDtyHQnZSrSmgTJidgGPZM0cFkyznfX6UfeMnhehRqxjaB+k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764742251; c=relaxed/simple; bh=xvDST+Z8myzBhMkBdsY5geGBvz0zNj5HlIe8aVSXmVQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uHwbMHnTSPoLE3+oPqwrFrZMGMSMfbgUdDfwM6GYh4cU4QDgcwGNunkPB59LN2k2AlzRiasHi2U1n8LeI/o2Obk4Nxrt6/UMgODfeAu5Y1vaWcyznSoRkWNXWWdTl/c5VGpyKL7rrYWx/tuagvolwGV4LgS60ldpQxbyEJOg07Q= 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 5CD1E68B05; Wed, 3 Dec 2025 07:10:46 +0100 (CET) Date: Wed, 3 Dec 2025 07:10:46 +0100 From: Christoph Hellwig To: Eugene Korenevsky Cc: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] nvme: nvme_identify_ns_descs: prevent oob Message-ID: <20251203061046.GA16562@lst.de> References: 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: User-Agent: Mutt/1.5.17 (2007-11-01) On Tue, Dec 02, 2025 at 09:22:13PM +0300, Eugene Korenevsky wrote: > @@ -1563,11 +1564,14 @@ static int nvme_identify_ns_descs(struct nvme_ctrl *ctrl, > goto free_data; > } > > - for (pos = 0; pos < NVME_IDENTIFY_DATA_SIZE; pos += len) { > - struct nvme_ns_id_desc *cur = data + pos; > + for (pos = 0; pos < NVME_IDENTIFY_DATA_SIZE - sizeof(*cur); pos += len) { Please avoid the overly long line. Otherwise this looks fine.