Skip to contentSkip to conversation

Bluetooth: Use kzalloc instead of kmalloc/memset

PATCH Applied Jiapeng Chong 3 participants 3 messages Oct 17, 2022 – Oct 19, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Use kzalloc instead of kmalloc/memset

Use kzalloc rather than duplicating its implementation, which makes code simple and easy to understand.

./net/bluetooth/hci_conn.c:2038:6-13: WARNING: kzalloc should be used for cp, instead of kmalloc/memset.

---
 net/bluetooth/hci_conn.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
net/bluetooth/hci_conn.c +1 -2
index 5d6ee5075642..495de21d52cd 100644
@@ -2035,13 +2035,12 @@ int hci_pa_create_sync(struct hci_dev *hdev, bdaddr_t *dst, __u8 dst_type,
 	if (hci_dev_test_and_set_flag(hdev, HCI_PA_SYNC))
 		return -EBUSY;
 
-	cp = kmalloc(sizeof(*cp), GFP_KERNEL);
+	cp = kzalloc(sizeof(*cp), GFP_KERNEL);
 	if (!cp) {
 		hci_dev_clear_flag(hdev, HCI_PA_SYNC);
 		return -ENOMEM;
 	}
 
-	memset(cp, 0, sizeof(*cp));
 	cp->sid = sid;
 	cp->addr_type = dst_type;
 	bacpy(&cp->addr, dst);
Signature · 1 line
2.20.1.7.g153144c
#1 lore raw

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=685692

---Test result---

Test Summary:

CheckPatch                    PASS      1.75 seconds
GitLint                       FAIL      0.85 seconds
SubjectPrefix                 PASS      0.67 seconds
BuildKernel                   PASS      41.90 seconds
BuildKernel32                 PASS      38.30 seconds
Incremental Build with patchesPASS      55.12 seconds
TestRunner: Setup             PASS      620.21 seconds
TestRunner: l2cap-tester      PASS      19.71 seconds
TestRunner: iso-tester        PASS      19.59 seconds
TestRunner: bnep-tester       PASS      7.76 seconds
TestRunner: mgmt-tester       PASS      123.33 seconds
TestRunner: rfcomm-tester     PASS      12.06 seconds
TestRunner: sco-tester        PASS      11.39 seconds
TestRunner: ioctl-tester      PASS      13.07 seconds
TestRunner: mesh-tester       PASS      9.42 seconds
TestRunner: smp-tester        PASS      11.30 seconds
TestRunner: userchan-tester   PASS      8.01 seconds

Details
##############################
Test: GitLint - FAIL - 0.85 seconds
Run gitlint with rule in .gitlint
Bluetooth: Use kzalloc instead of kmalloc/memset
6: B1 Line exceeds max length (104>80): "./net/bluetooth/hci_conn.c:2038:6-13: WARNING: kzalloc should be used for cp, instead of kmalloc/memset."

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Jiapeng Chong
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

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

Quoted 10 lines · On Mon, 17 Oct 2022 13:47:13 +0800 you wrote:

Use kzalloc rather than duplicating its implementation, which makes code simple and easy to understand.

./net/bluetooth/hci_conn.c:2038:6-13: WARNING: kzalloc should be used for cp, instead of kmalloc/memset.

[...]

Here is the summary with links:
- Bluetooth: Use kzalloc instead of kmalloc/memset

    https://git.kernel.org/bluetooth/bluetooth-next/c/b0a19a2c4c53

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html