2023-06-25 08:47:53

by Jiapeng Chong

[permalink] [raw]
Subject: [PATCH] Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy

Use kmemdup rather than duplicating its implementation.

./net/bluetooth/hci_conn.c:1880:7-14: WARNING opportunity for kmemdup.

Reported-by: Abaci Robot <[email protected]>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5597
Signed-off-by: Jiapeng Chong <[email protected]>
---
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



2023-06-25 09:56:30

by bluez.test.bot

[permalink] [raw]
Subject: RE: Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=760042

---Test result---

Test Summary:
CheckPatch PASS 0.83 seconds
GitLint PASS 0.38 seconds
SubjectPrefix PASS 0.13 seconds
BuildKernel PASS 43.44 seconds
CheckAllWarning PASS 48.03 seconds
CheckSparse PASS 53.73 seconds
CheckSmatch PASS 146.70 seconds
BuildKernel32 PASS 42.48 seconds
TestRunnerSetup PASS 604.44 seconds
TestRunner_l2cap-tester PASS 21.55 seconds
TestRunner_iso-tester FAIL 31.74 seconds
TestRunner_bnep-tester PASS 7.74 seconds
TestRunner_mgmt-tester PASS 162.79 seconds
TestRunner_rfcomm-tester PASS 12.28 seconds
TestRunner_sco-tester PASS 11.08 seconds
TestRunner_ioctl-tester PASS 13.28 seconds
TestRunner_mesh-tester PASS 9.83 seconds
TestRunner_smp-tester PASS 10.66 seconds
TestRunner_userchan-tester PASS 8.00 seconds
IncrementalBuild PASS 40.10 seconds

Details
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 80, Passed: 76 (95.0%), Failed: 4, Not Run: 0

Failed Test Cases
ISO Receive - Success Failed 0.272 seconds
ISO Receive Timestamped - Success Failed 0.256 seconds
ISO Defer Receive - Success Failed 0.260 seconds
ISO 48_2_1 Defer Receive - Success Failed 0.264 seconds


---
Regards,
Linux Bluetooth

2023-06-26 20:46:20

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <[email protected]>:

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 <[email protected]>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5597
> Signed-off-by: Jiapeng Chong <[email protected]>
>
> [...]

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