From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (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 975791E5B68 for ; Tue, 3 Mar 2026 21:31:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772573481; cv=none; b=C5t1+oTKqh8GBo3vuVIB0wmIAgbjuGMLwM3SnAlG15qojanekrElOnzqftREFn1jfPmn+YuYzI75c7e/8/Jvg9z9LVCfHbx6dv5JzxYSXQp83MwaLhvCTzX+9vg+0fmVQ/pWQDkiNM8B/hZG68gXU2rljwsZWNiwXNxIRBAYI5Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772573481; c=relaxed/simple; bh=PwTwwqktZ3gW1Jqj92nq+R6/p4rm2Yr9+ncbAvRhLzM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XzoznnXmLVduBIqlUYq+++8euazIrPsGcMGtQgk2x4xlOMh/9Xcty3ftmyV2XEwF82QASMXEfg1b8ueAltZiHWfELpi420/wu9n2zVPsi2sh2ebGk4j12no9V+ACcTxbs0WeiG6nN1MoSNbmO50i9jlHZO1GST7EqEqpuNdDGxc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=MnMyrbvZ; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="MnMyrbvZ" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772573477; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=BhfXApBIUsq6uQNF+gadNYk7qtXOqeeNSnRgXkrVeXU=; b=MnMyrbvZuGBJJwVLHFvHJZ2IBLRTxOZpR7SBwmcJIJSl+KnpVaQvVKg3rrtg8fNLyYeNIx lMFm+9h2SGIX/KBBQm7dNX+syPiGkfm1Y2aWvIP5USnCL29OgbABLq4ItUQKas1xhkpN2L V5vMVbO2CAtkBozPFWaQXYaUGsCLDqg= From: Thorsten Blum To: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Hannes Reinecke , Kees Cook , "Gustavo A. R. Silva" Cc: Thorsten Blum , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH] nvme: Annotate struct nvme_dhchap_key with __counted_by Date: Tue, 3 Mar 2026 22:31:01 +0100 Message-ID: <20260303213102.86585-1-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Add the __counted_by() compiler attribute to the flexible array member 'key' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Signed-off-by: Thorsten Blum --- include/linux/nvme-auth.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/nvme-auth.h b/include/linux/nvme-auth.h index 60e069a6757f..e75c29c51464 100644 --- a/include/linux/nvme-auth.h +++ b/include/linux/nvme-auth.h @@ -11,7 +11,7 @@ struct nvme_dhchap_key { size_t len; u8 hash; - u8 key[]; + u8 key[] __counted_by(len); }; u32 nvme_auth_get_seqnum(void); -- Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4