Skip to content

Commit fa655a9

Browse files
tobluxkeithbusch
authored andcommitted
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. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 0375c81 commit fa655a9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

include/linux/nvme-auth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
struct nvme_dhchap_key {
1212
size_t len;
1313
u8 hash;
14-
u8 key[];
14+
u8 key[] __counted_by(len);
1515
};
1616

1717
u32 nvme_auth_get_seqnum(void);

0 commit comments

Comments
 (0)