Patch "Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bluetooth-hci_conn-use-kmemdup-to-replace-kzalloc-me.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit ee5f754034255f105be39a825cfccb83d7d60e6f
Author: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
Date:   Sun Jun 25 16:45:13 2023 +0800

    Bluetooth: hci_conn: Use kmemdup() to replace kzalloc + memcpy
    
    [ Upstream commit 5b6d345d1b65d67624349e5de22227492c637576 ]
    
    Use kmemdup rather than duplicating its implementation.
    
    ./net/bluetooth/hci_conn.c:1880:7-14: WARNING opportunity for kmemdup.
    
    Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
    Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5597
    Signed-off-by: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Stable-dep-of: a09128921820 ("Bluetooth: hci_conn: Fix hci_le_set_cig_params")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index ee9d6ff75246f..7516166652a08 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1886,12 +1886,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)
 		return false;
 
-	pdu = kzalloc(sizeof(*pdu), GFP_KERNEL);
+	pdu = kmemdup(&data.pdu, sizeof(*pdu), GFP_KERNEL);
 	if (!pdu)
 		return false;
 
-	memcpy(pdu, &data.pdu, sizeof(*pdu));
-
 	if (hci_cmd_sync_queue(hdev, set_cig_params_sync, pdu,
 			       set_cig_params_complete) < 0) {
 		kfree(pdu);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux