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

Configure Feed

Select the types of activity you want to include in your feed.

Bluetooth: btintel_pcie: Use struct_size to improve hci_drv_read_info

Use struct_size(), which provides additional compile-time checks for
structures with flexible array members (e.g., __must_be_array()), to
determine the allocation size for a new 'struct hci_drv_rp_read_info'.

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
9a9d21f7 67377cd3

+2 -1
+2 -1
drivers/bluetooth/btintel_pcie.c
··· 9 9 #include <linux/kernel.h> 10 10 #include <linux/module.h> 11 11 #include <linux/firmware.h> 12 + #include <linux/overflow.h> 12 13 #include <linux/pci.h> 13 14 #include <linux/string.h> 14 15 #include <linux/wait.h> ··· 2374 2373 u16 opcode, num_supported_commands = 2375 2374 ARRAY_SIZE(btintel_pcie_hci_drv_supported_commands); 2376 2375 2377 - rp_size = sizeof(*rp) + num_supported_commands * 2; 2376 + rp_size = struct_size(rp, supported_commands, num_supported_commands); 2378 2377 2379 2378 rp = kmalloc(rp_size, GFP_KERNEL); 2380 2379 if (!rp)