Skip to content

Commit f1a9a7c

Browse files
wb-zjp846396Vudentz
authored andcommitted
Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy
Use kmemdup rather than duplicating its implementation. ./net/bluetooth/hci_conn.c:1880:7-14: WARNING opportunity for kmemdup. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5597 Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent 6d5475f commit f1a9a7c

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

net/bluetooth/hci_conn.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,12 +1877,10 @@ static bool hci_le_set_cig_params(struct hci_conn *conn, struct bt_iso_qos *qos)
18771877
if (qos->ucast.cis == BT_ISO_QOS_CIS_UNSET || !data.pdu.cp.num_cis)
18781878
return false;
18791879

1880-
pdu = kzalloc(sizeof(*pdu), GFP_KERNEL);
1880+
pdu = kmemdup(&data.pdu, sizeof(*pdu), GFP_KERNEL);
18811881
if (!pdu)
18821882
return false;
18831883

1884-
memcpy(pdu, &data.pdu, sizeof(*pdu));
1885-
18861884
if (hci_cmd_sync_queue(hdev, set_cig_params_sync, pdu,
18871885
set_cig_params_complete) < 0) {
18881886
kfree(pdu);

0 commit comments

Comments
 (0)