* [PATCH -next] Bluetooth: Use kzalloc instead of kmalloc/memset
@ 2016-09-10 12:21 Wei Yongjun
2016-09-12 7:15 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Wei Yongjun @ 2016-09-10 12:21 UTC (permalink / raw)
To: Marcel Holtmann, Gustavo Padovan, Johan Hedberg
Cc: Wei Yongjun, linux-bluetooth
From: Wei Yongjun <weiyongjun1@huawei.com>
Use kzalloc rather than kmalloc followed by memset with 0.
Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
net/bluetooth/mgmt.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 74179b9..0ac881c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -902,12 +902,10 @@ static int read_ext_controller_info(struct sock *sk, struct hci_dev *hdev,
eir_len = eir_append_data(buff, eir_len, EIR_NAME_SHORT,
hdev->short_name, name_len);
- rp = kmalloc(sizeof(*rp) + eir_len, GFP_KERNEL);
+ rp = kzalloc(sizeof(*rp) + eir_len, GFP_KERNEL);
if (!rp)
return -ENOMEM;
- memset(rp, 0, sizeof(*rp) + eir_len);
-
rp->eir_len = cpu_to_le16(eir_len);
memcpy(rp->eir, buff, eir_len);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] Bluetooth: Use kzalloc instead of kmalloc/memset
2016-09-10 12:21 [PATCH -next] Bluetooth: Use kzalloc instead of kmalloc/memset Wei Yongjun
@ 2016-09-12 7:15 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2016-09-12 7:15 UTC (permalink / raw)
To: Wei Yongjun
Cc: Gustavo F. Padovan, Johan Hedberg, Wei Yongjun, linux-bluetooth
Hi Wei,
> Use kzalloc rather than kmalloc followed by memset with 0.
>
> Generated by: scripts/coccinelle/api/alloc/kzalloc-simple.cocci
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> net/bluetooth/mgmt.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-12 7:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-10 12:21 [PATCH -next] Bluetooth: Use kzalloc instead of kmalloc/memset Wei Yongjun
2016-09-12 7:15 ` Marcel Holtmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.