[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220920031958.3092-1-hanyihao@vivo.com>
Date: Mon, 19 Sep 2022 20:19:58 -0700
From: Yihao Han <hanyihao@...o.com>
To: Marcel Holtmann <marcel@...tmann.org>,
Johan Hedberg <johan.hedberg@...il.com>,
Luiz Augusto von Dentz <luiz.dentz@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
linux-bluetooth@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Yihao Han <hanyihao@...o.com>
Subject: [PATCH] Bluetooth: MGMT: fix zalloc-simple.cocci warnings
Use zeroing allocator rather than allocator followed by memset with 0
Generated by: scripts/coccinelle/api/alloc/zalloc-simple.cocci
Signed-off-by: Yihao Han <hanyihao@...o.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 b9b64030a7b0..a92e7e485feb 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -4397,12 +4397,10 @@ static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev,
/* Enough space for 7 features */
len = sizeof(*rp) + (sizeof(rp->features[0]) * 7);
- rp = kmalloc(len, GFP_KERNEL);
+ rp = kzalloc(len, GFP_KERNEL);
if (!rp)
return -ENOMEM;
- memset(rp, 0, len);
-
#ifdef CONFIG_BT_FEATURE_DEBUG
if (!hdev) {
flags = bt_dbg_get() ? BIT(0) : 0;
--
2.17.1
Powered by blists - more mailing lists