linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy
@ 2023-06-25  8:45 Jiapeng Chong
  2023-06-25  9:39 ` bluez.test.bot
  2023-06-26 20:42 ` [PATCH] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ 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 related	[flat|nested] 3+ messages in thread

* RE: 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-25  9:39 ` bluez.test.bot
  2023-06-26 20:42 ` [PATCH] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2023-06-25  9:39 UTC (permalink / raw)
  To: linux-bluetooth, jiapeng.chong

[-- Attachment #1: Type: text/plain, Size: 1936 bytes --]

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


^ permalink raw reply	[flat|nested] 3+ 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-25  9:39 ` bluez.test.bot
@ 2023-06-26 20:42 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ 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] 3+ messages in thread

end of thread, other threads:[~2023-06-26 20:42 UTC | newest]

Thread overview: 3+ 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-25  9:39 ` bluez.test.bot
2023-06-26 20:42 ` [PATCH] " 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;
as well as URLs for NNTP newsgroup(s).