* [PATCH] Bluetooth: btintel_pcie: Use struct_size to improve hci_drv_read_info
@ 2026-02-23 23:33 Thorsten Blum
2026-02-24 20:30 ` patchwork-bot+bluetooth
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-02-23 23:33 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz
Cc: Thorsten Blum, linux-bluetooth, linux-kernel
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>
---
drivers/bluetooth/btintel_pcie.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btintel_pcie.c b/drivers/bluetooth/btintel_pcie.c
index eda243988cfd..473b2115e637 100644
--- a/drivers/bluetooth/btintel_pcie.c
+++ b/drivers/bluetooth/btintel_pcie.c
@@ -9,6 +9,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/firmware.h>
+#include <linux/overflow.h>
#include <linux/pci.h>
#include <linux/string.h>
#include <linux/wait.h>
@@ -2373,7 +2374,7 @@ static int btintel_pcie_hci_drv_read_info(struct hci_dev *hdev, void *data,
u16 opcode, num_supported_commands =
ARRAY_SIZE(btintel_pcie_hci_drv_supported_commands);
- rp_size = sizeof(*rp) + num_supported_commands * 2;
+ rp_size = struct_size(rp, supported_commands, num_supported_commands);
rp = kmalloc(rp_size, GFP_KERNEL);
if (!rp)
--
Thorsten Blum <thorsten.blum@linux.dev>
GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: btintel_pcie: Use struct_size to improve hci_drv_read_info
2026-02-23 23:33 [PATCH] Bluetooth: btintel_pcie: Use struct_size to improve hci_drv_read_info Thorsten Blum
@ 2026-02-24 20:30 ` patchwork-bot+bluetooth
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2026-02-24 20:30 UTC (permalink / raw)
To: Thorsten Blum; +Cc: marcel, luiz.dentz, linux-bluetooth, linux-kernel
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 24 Feb 2026 00:33:42 +0100 you wrote:
> 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>
> ---
> drivers/bluetooth/btintel_pcie.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Here is the summary with links:
- Bluetooth: btintel_pcie: Use struct_size to improve hci_drv_read_info
https://git.kernel.org/bluetooth/bluetooth-next/c/932fa6b5adb7
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-24 20:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 23:33 [PATCH] Bluetooth: btintel_pcie: Use struct_size to improve hci_drv_read_info Thorsten Blum
2026-02-24 20:30 ` patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox