* [PATCH] Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy
@ 2023-06-25 8:45 Jiapeng Chong
2023-06-26 20:42 ` patchwork-bot+bluetooth
0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2023-06-25 8:45 UTC (permalink / raw)
To: marcel
Cc: johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel,
Jiapeng Chong, Abaci Robot
Use kmemdup rather than duplicating its implementation.
./net/bluetooth/hci_conn.c:1880:7-14: WARNING opportunity for kmemdup.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5597
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
net/bluetooth/hci_conn.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 62a7ccfdfe63..47e7aa4d63a9 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1877,12 +1877,10 @@ static bool hci_le_set_cig_params(struct hci_conn *conn, struct bt_iso_qos *qos)
if (qos->ucast.cis == BT_ISO_QOS_CIS_UNSET || !data.pdu.cp.num_cis)
return false;
- pdu = kzalloc(sizeof(*pdu), GFP_KERNEL);
+ pdu = kmemdup(&data.pdu, sizeof(*pdu), GFP_KERNEL);
if (!pdu)
return false;
- memcpy(pdu, &data.pdu, sizeof(*pdu));
-
if (hci_cmd_sync_queue(hdev, set_cig_params_sync, pdu,
set_cig_params_complete) < 0) {
kfree(pdu);
--
2.20.1.7.g153144c
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy
2023-06-25 8:45 [PATCH] Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy Jiapeng Chong
@ 2023-06-26 20:42 ` patchwork-bot+bluetooth
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+bluetooth @ 2023-06-26 20:42 UTC (permalink / raw)
To: Jiapeng Chong
Cc: marcel, johan.hedberg, luiz.dentz, linux-bluetooth, linux-kernel, abaci
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Sun, 25 Jun 2023 16:45:13 +0800 you wrote:
> Use kmemdup rather than duplicating its implementation.
>
> ./net/bluetooth/hci_conn.c:1880:7-14: WARNING opportunity for kmemdup.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5597
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
>
> [...]
Here is the summary with links:
- Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy
https://git.kernel.org/bluetooth/bluetooth-next/c/f1a9a7cc825f
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:[~2023-06-26 20:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-25 8:45 [PATCH] Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy Jiapeng Chong
2023-06-26 20:42 ` 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
all inboxes | Powered by JetHome®