From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-86.freemail.mail.aliyun.com (out30-86.freemail.mail.aliyun.com [115.124.30.86]) (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 A9A332F25F1 for ; Tue, 2 Dec 2025 20:30:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.86 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764707414; cv=none; b=iAlg1L2T1NwIOTDK1dPINtmhzpb1QssCwwNzFHgiHNLHj5wR+kq9GCtj/ZNAAd580c4LY78v0dM1VizoVjgSLMzpjY0upbBDf8CdGq7NpAL+OBhrGSFwQUTYF+IdjzKaJnxexN3B7H1y3ey6FEjxR2h2YSqEC/ZpQip+8L/0AQs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764707414; c=relaxed/simple; bh=3dPtqNutRnyH1omkVWCTa06TqZm0/4Vkw7EdIvP0vNY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=X7/PQOQ4MWDd8FQtK0DuIUVwLtSDFFosn1wpC8PXMzLz2oiwbqzsBJiXRa0dPwR7ZacDvAP39Z4q1ZTaK2Zteezuh4aEN2MRnPJu6/pVrz1rv324YnOoF5P+kMFlBJD5rFaHD4WBMi+TDyNpZPvMuzmLUVu6u/QVDQIP3+USJzw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aliyun.com; spf=pass smtp.mailfrom=aliyun.com; dkim=pass (1024-bit key) header.d=aliyun.com header.i=@aliyun.com header.b=dTwMcEzA; arc=none smtp.client-ip=115.124.30.86 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aliyun.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aliyun.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=aliyun.com header.i=@aliyun.com header.b="dTwMcEzA" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=aliyun.com; s=s1024; t=1764707409; h=Date:From:To:Subject:Message-ID:MIME-Version:Content-Type; bh=Pu5izOjh3tRvyNJZ54kEpgX2g6ULDR3XI5cmromcEt4=; b=dTwMcEzAKtefI2vwbWCa7Ub8fUDQY1LVj00RbVwfwAY3RsYEwKCMVXUqmI1HpaB5t23rh8t6Ugz6PVO/Rk+oEDaEYSYrduqafCAqkuqSoBPyhjfIyqoKjM04LdT57COXcpW3Ayp0Aglef1ljdG1wadwjp6O47q8big7OHRcfnNI= Received: from aliyun.com(mailfrom:ekorenevsky@aliyun.com fp:SMTPD_---0WtxxRk2_1764707406 cluster:ay36) by smtp.aliyun-inc.com; Wed, 03 Dec 2025 04:30:08 +0800 Date: Tue, 2 Dec 2025 23:30:04 +0300 From: Eugene Korenevsky To: Keith Busch Cc: Jens Axboe , Christoph Hellwig , Sagi Grimberg , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] nvme: nvme_identify_ns_descs: prevent oob Message-ID: 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: > > - for (pos = 0; pos < NVME_IDENTIFY_DATA_SIZE; pos += len) { > > - struct nvme_ns_id_desc *cur = data + pos; > > + pos = 0; > > + do { > > + } while (pos < NVME_IDENTIFY_DATA_SIZE - sizeof(*cur)); > I don't want bikeshed this, but I thought this looked better as a > for-loop. You can just modify the continuing condition instead of > changing the loop type to do-while. OK, tried to make the patch as close as possible to previous code. See v4. Also, adding 'pos += len' to modified `for` makes the line longer than 80 symbols. However, checkpatch.pl says it is OK. Let me know if it should be fixed somehow (e.g. by moving 'pos += len' to the end of loop compound statement).