Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: Annotate struct hci_drv_rp_read_info with __counted_by_le()

Add the __counted_by_le() compiler attribute to the flexible array
member 'supported_commands' to improve access bounds-checking via
CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Thorsten Blum and committed by
Luiz Augusto von Dentz
d4e99db3 3e942629

+1 -1
+1 -1
include/net/bluetooth/hci_drv.h
··· 47 47 struct hci_drv_rp_read_info { 48 48 __u8 driver_name[HCI_DRV_MAX_DRIVER_NAME_LENGTH]; 49 49 __le16 num_supported_commands; 50 - __le16 supported_commands[]; 50 + __le16 supported_commands[] __counted_by_le(num_supported_commands); 51 51 } __packed; 52 52 53 53 /* Driver specific OGF (Opcode Group Field)