diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2016-09-10 08:21:22 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2016-09-19 14:19:34 -0400 |
commit | 3e36ca483a642f441b8e29b4e98091f2c62bfb38 (patch) | |
tree | 049d5ea43cab5b855a10bd7c2c698abcc4039980 /net/bluetooth | |
parent | 4037a7747d7b5a3e5bb4d10fb9ea6e2fd8a23c3b (diff) |
Bluetooth: Use kzalloc instead of kmalloc/memset
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>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/mgmt.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 74179b92ef22..0ac881cfc646 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, | |||
902 | eir_len = eir_append_data(buff, eir_len, EIR_NAME_SHORT, | 902 | eir_len = eir_append_data(buff, eir_len, EIR_NAME_SHORT, |
903 | hdev->short_name, name_len); | 903 | hdev->short_name, name_len); |
904 | 904 | ||
905 | rp = kmalloc(sizeof(*rp) + eir_len, GFP_KERNEL); | 905 | rp = kzalloc(sizeof(*rp) + eir_len, GFP_KERNEL); |
906 | if (!rp) | 906 | if (!rp) |
907 | return -ENOMEM; | 907 | return -ENOMEM; |
908 | 908 | ||
909 | memset(rp, 0, sizeof(*rp) + eir_len); | ||
910 | |||
911 | rp->eir_len = cpu_to_le16(eir_len); | 909 | rp->eir_len = cpu_to_le16(eir_len); |
912 | memcpy(rp->eir, buff, eir_len); | 910 | memcpy(rp->eir, buff, eir_len); |
913 | 911 | ||