Commit 5b6d345d authored by Jiapeng Chong's avatar Jiapeng Chong Committed by Jakub Kicinski

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: default avatarAbaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5597Signed-off-by: default avatarJiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent fa01eba1
...@@ -1862,12 +1862,10 @@ static bool hci_le_set_cig_params(struct hci_conn *conn, struct bt_iso_qos *qos) ...@@ -1862,12 +1862,10 @@ static bool hci_le_set_cig_params(struct hci_conn *conn, struct bt_iso_qos *qos)
if (qos->ucast.cis == BT_ISO_QOS_CIS_UNSET || !data.pdu.cp.num_cis) if (qos->ucast.cis == BT_ISO_QOS_CIS_UNSET || !data.pdu.cp.num_cis)
return false; return false;
pdu = kzalloc(sizeof(*pdu), GFP_KERNEL); pdu = kmemdup(&data.pdu, sizeof(*pdu), GFP_KERNEL);
if (!pdu) if (!pdu)
return false; return false;
memcpy(pdu, &data.pdu, sizeof(*pdu));
if (hci_cmd_sync_queue(hdev, set_cig_params_sync, pdu, if (hci_cmd_sync_queue(hdev, set_cig_params_sync, pdu,
set_cig_params_complete) < 0) { set_cig_params_complete) < 0) {
kfree(pdu); kfree(pdu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment