linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: bluetooth: Use kzalloc instead of kmalloc/memset
@ 2022-10-17  3:04 Jiapeng Chong
  2022-10-17  3:58 ` bluez.test.bot
  2022-10-19 23:10 ` [PATCH] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 4+ messages in thread
From: Jiapeng Chong @ 2022-10-17  3:04 UTC (permalink / raw)
  To: marcel
  Cc: johan.hedberg, luiz.dentz, davem, edumazet, kuba, pabeni,
	linux-bluetooth, netdev, linux-kernel, Jiapeng Chong, Abaci Robot

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.

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2406
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 net/bluetooth/hci_conn.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 5d6ee5075642..495de21d52cd 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -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);
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: net: bluetooth: Use kzalloc instead of kmalloc/memset
  2022-10-17  3:04 [PATCH] net: bluetooth: Use kzalloc instead of kmalloc/memset Jiapeng Chong
@ 2022-10-17  3:58 ` bluez.test.bot
  2022-10-19 23:10 ` [PATCH] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2022-10-17  3:58 UTC (permalink / raw)
  To: linux-bluetooth, jiapeng.chong

[-- Attachment #1: Type: text/plain, Size: 1733 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=685678

---Test result---

Test Summary:
CheckPatch                    PASS      1.85 seconds
GitLint                       FAIL      1.00 seconds
SubjectPrefix                 FAIL      0.89 seconds
BuildKernel                   PASS      34.47 seconds
BuildKernel32                 PASS      30.51 seconds
Incremental Build with patchesPASS      44.59 seconds
TestRunner: Setup             PASS      507.42 seconds
TestRunner: l2cap-tester      PASS      17.03 seconds
TestRunner: iso-tester        PASS      15.91 seconds
TestRunner: bnep-tester       PASS      6.36 seconds
TestRunner: mgmt-tester       PASS      102.95 seconds
TestRunner: rfcomm-tester     PASS      10.09 seconds
TestRunner: sco-tester        PASS      9.50 seconds
TestRunner: ioctl-tester      PASS      10.62 seconds
TestRunner: mesh-tester       PASS      7.68 seconds
TestRunner: smp-tester        PASS      9.46 seconds
TestRunner: userchan-tester   PASS      6.53 seconds

Details
##############################
Test: GitLint - FAIL - 1.00 seconds
Run gitlint with rule in .gitlint
net: 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."


##############################
Test: SubjectPrefix - FAIL - 0.89 seconds
Check subject contains "Bluetooth" prefix
"Bluetooth: " is not specified in the subject



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: bluetooth: Use kzalloc instead of kmalloc/memset
  2022-10-17  3:04 [PATCH] net: bluetooth: Use kzalloc instead of kmalloc/memset Jiapeng Chong
  2022-10-17  3:58 ` bluez.test.bot
@ 2022-10-19 23:10 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2022-10-19 23:10 UTC (permalink / raw)
  To: Jiapeng Chong
  Cc: marcel, johan.hedberg, luiz.dentz, davem, edumazet, kuba, pabeni,
	linux-bluetooth, netdev, 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 Mon, 17 Oct 2022 11:04:21 +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.
> 
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2406
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> 
> [...]

Here is the summary with links:
  - net: bluetooth: Use kzalloc instead of kmalloc/memset
    https://git.kernel.org/bluetooth/bluetooth-next/c/b0a19a2c4c53

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] 4+ messages in thread

* RE: net: bluetooth: Use kzalloc instead of kmalloc/memset
  2022-10-29 20:45 Kang Minchul
@ 2022-10-29 21:08 ` bluez.test.bot
  0 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2022-10-29 21:08 UTC (permalink / raw)
  To: linux-bluetooth, tegongkang

[-- Attachment #1: Type: text/plain, Size: 1429 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=690180

---Test result---

Test Summary:
CheckPatch                    PASS      1.31 seconds
GitLint                       PASS      0.78 seconds
SubjectPrefix                 FAIL      0.66 seconds
BuildKernel                   PASS      35.29 seconds
BuildKernel32                 PASS      31.05 seconds
Incremental Build with patchesPASS      47.28 seconds
TestRunner: Setup             PASS      519.68 seconds
TestRunner: l2cap-tester      PASS      17.22 seconds
TestRunner: iso-tester        PASS      16.32 seconds
TestRunner: bnep-tester       PASS      6.29 seconds
TestRunner: mgmt-tester       PASS      104.09 seconds
TestRunner: rfcomm-tester     PASS      10.15 seconds
TestRunner: sco-tester        PASS      9.51 seconds
TestRunner: ioctl-tester      PASS      10.81 seconds
TestRunner: mesh-tester       PASS      7.72 seconds
TestRunner: smp-tester        PASS      9.45 seconds
TestRunner: userchan-tester   PASS      6.49 seconds

Details
##############################
Test: SubjectPrefix - FAIL - 0.66 seconds
Check subject contains "Bluetooth" prefix
"Bluetooth: " is not specified in the subject



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-29 21:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-17  3:04 [PATCH] net: bluetooth: Use kzalloc instead of kmalloc/memset Jiapeng Chong
2022-10-17  3:58 ` bluez.test.bot
2022-10-19 23:10 ` [PATCH] " patchwork-bot+bluetooth
  -- strict thread matches above, loose matches on Subject: below --
2022-10-29 20:45 Kang Minchul
2022-10-29 21:08 ` bluez.test.bot

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).