Skip to contentSkip to conversation

nvme: Annotate struct nvme_dhchap_key with __counted_by

PATCH Applied Thorsten Blum 3 participants 3 messages Mar 3 – Mar 10

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: Annotate struct nvme_dhchap_key with __counted_by

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.

---
 include/linux/nvme-auth.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/nvme-auth.h +1 -1
index 60e069a6757f..e75c29c51464 100644
@@ -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);
Signature · 2 lines
Thorsten Blum <[email protected]>
GPG: 1D60 735E 8AEF 3BE4 73B6  9D84 7336 78FD 8DFE EAD4
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Thorsten Blum

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.

Looks good:

maintainer Applied
#2 lore raw
Quoted 4 lines · Christoph Hellwig
Quoted 3 lines · Thorsten Blum

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.

Thanks, applied.