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 96337271A7C for ; Tue, 17 Mar 2026 14:51:41 +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=1773759102; cv=none; b=m+zQHCbW+cGuo2bB4oTZMKPFjBIxoehWsAIx5k3/La0p+AIBGEap95g4UF6gT+5ElX7R3WGxQaUtuuOTgoy10XVHcd7Qenb/wU8FBRod/ZfnAgEKNQQmLXnk8W07lCONTCca6PdWiMAZreQIrQzmhkhCDokBJ2SfWhIFDWCQjP0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773759102; c=relaxed/simple; bh=Jmo+joqQ/MJROwW4utyGwAEHyAo/4v9IV7VbV+cJlMU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=j9ej548YMZhieFY4JZtJAPFTNQv9E92Y7RxqD6z3iTsCJRwhteoNFJNXi+Lobk1YKi4mAfhBURV7jvXbz7taV5z9YF4FSrxfQX/Fjd1+m8znDPGoX98jp1WooYTrZPSq6IfTwCG3twHiqYxG3uhoh1ZZ6SDbemty0Vmiv0zsDEU= 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 9CD0668BEB; Tue, 17 Mar 2026 15:51:37 +0100 (CET) Date: Tue, 17 Mar 2026 15:51:37 +0100 From: Christoph Hellwig To: YunJe Shin Cc: hare@suse.de, cleech@redhat.com, hch@lst.de, ioerts@kookmin.ac.kr, kbusch@kernel.org, kch@nvidia.com, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, sagi@grimberg.me, stable@kernel.org Subject: Re: [PATCH v2] nvmet: auth: validate dhchap id list lengths Message-ID: <20260317145137.GA6462@lst.de> References: <20260313052444.3865842-1-ioerts@kookmin.ac.kr> 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: <20260313052444.3865842-1-ioerts@kookmin.ac.kr> User-Agent: Mutt/1.5.17 (2007-11-01) On Fri, Mar 13, 2026 at 02:24:09PM +0900, YunJe Shin wrote: > + /* > + * idlist[0..29]: hash IDs > + * idlist[30..59]: DH group IDs > + */ > + if (data->auth_protocol[0].dhchap.halen > NVME_AUTH_DHCHAP_MAX_HASH_IDS || > + data->auth_protocol[0].dhchap.dhlen > NVME_AUTH_DHCHAP_MAX_DH_IDS) Overly lone lines. A local variable for data->auth_protocol[0].dhchap would really help with readability here. > diff --git a/include/linux/nvme.h b/include/linux/nvme.h > index b09dcaf5bcbc..ea0393ab16fc 100644 > --- a/include/linux/nvme.h > +++ b/include/linux/nvme.h > @@ -1824,6 +1824,8 @@ struct nvmf_auth_dhchap_protocol_descriptor { > __u8 dhlen; > __u8 idlist[60]; > }; > +#define NVME_AUTH_DHCHAP_MAX_HASH_IDS 30 > +#define NVME_AUTH_DHCHAP_MAX_DH_IDS 30 Tabs before the values. Bonus points for a reference to the relevant spec.