]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
nvme: Annotate struct nvme_dhchap_key with __counted_by
authorThorsten Blum <thorsten.blum@linux.dev>
Tue, 3 Mar 2026 21:31:01 +0000 (22:31 +0100)
committerKeith Busch <kbusch@kernel.org>
Tue, 10 Mar 2026 15:20:29 +0000 (08:20 -0700)
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.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Keith Busch <kbusch@kernel.org>
include/linux/nvme-auth.h

index 60e069a6757ff6421da500279ea998431eb414bb..e75c29c51464cec4b76f095196913d29fcd3b117 100644 (file)
@@ -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);