]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: MGMT: Fix sparse errors
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 11 Jun 2025 20:36:27 +0000 (16:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jun 2025 13:32:30 +0000 (15:32 +0200)
[ Upstream commit 7dd38ba4acbea9875b4ee061e20a26413e39d9f4 ]

This fixes the following errors:

net/bluetooth/mgmt.c:5400:59: sparse: sparse: incorrect type in argument 3
(different base types) @@     expected unsigned short [usertype] handle @@
got restricted __le16 [usertype] monitor_handle @@
net/bluetooth/mgmt.c:5400:59: sparse:     expected unsigned short [usertype] handle
net/bluetooth/mgmt.c:5400:59: sparse:     got restricted __le16 [usertype] monitor_handle

Fixes: e6ed54e86aae ("Bluetooth: MGMT: Fix UAF on mgmt_remove_adv_monitor_complete")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506060347.ux2O1p7L-lkp@intel.com/
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/mgmt.c

index 70a26c895512f424fdb682feb3043450d78c8862..7664e7ba372ceeceaef678d513216d2d949b6ade 100644 (file)
@@ -5166,11 +5166,11 @@ static void mgmt_adv_monitor_added(struct sock *sk, struct hci_dev *hdev,
 }
 
 static void mgmt_adv_monitor_removed(struct sock *sk, struct hci_dev *hdev,
-                                    u16 handle)
+                                    __le16 handle)
 {
        struct mgmt_ev_adv_monitor_removed ev;
 
-       ev.monitor_handle = cpu_to_le16(handle);
+       ev.monitor_handle = handle;
 
        mgmt_event(MGMT_EV_ADV_MONITOR_REMOVED, hdev, &ev, sizeof(ev), sk);
 }