summaryrefslogtreecommitdiff
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2022-01-09 14:14:08 -0800
committerJakub Kicinski <kuba@kernel.org>2022-01-09 14:14:09 -0800
commit9f3248c9dd51912ded87562a892ad947da2eebfa (patch)
treefaa53828a2620c3acae5158ea00d8b0863996402 /net/bluetooth/hci_event.c
parentd5c8725cc913f1ab8e2f10a4eda2930bfdc03f1f (diff)
parentb9f9dbad0bd1c302d357fdd327c398f51f5fc2b1 (diff)
Merge tag 'for-net-next-2022-01-07' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Luiz Augusto von Dentz says: ==================== bluetooth-next pull request for net-next: - Add support for Foxconn QCA 0xe0d0 - Fix HCI init sequence on MacBook Air 8,1 and 8,2 - Fix Intel firmware loading on legacy ROM devices * tag 'for-net-next-2022-01-07' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next: Bluetooth: hci_sock: fix endian bug in hci_sock_setsockopt() Bluetooth: L2CAP: uninitialized variables in l2cap_sock_setsockopt() Bluetooth: btqca: sequential validation Bluetooth: btusb: Add support for Foxconn QCA 0xe0d0 Bluetooth: btintel: Fix broken LED quirk for legacy ROM devices Bluetooth: hci_event: Rework hci_inquiry_result_with_rssi_evt Bluetooth: btbcm: disable read tx power for MacBook Air 8,1 and 8,2 Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe Bluetooth: hci_bcm: Check for error irq ==================== Link: https://lore.kernel.org/r/20220107210942.3750887-1-luiz.dentz@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index f1082b7c0218..fc30f4c03d29 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -4507,16 +4507,13 @@ static void hci_pscan_rep_mode_evt(struct hci_dev *hdev, void *data,
static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,
struct sk_buff *skb)
{
- union {
- struct hci_ev_inquiry_result_rssi *res1;
- struct hci_ev_inquiry_result_rssi_pscan *res2;
- } *ev = edata;
+ struct hci_ev_inquiry_result_rssi *ev = edata;
struct inquiry_data data;
int i;
- bt_dev_dbg(hdev, "num_rsp %d", ev->res1->num);
+ bt_dev_dbg(hdev, "num_rsp %d", ev->num);
- if (!ev->res1->num)
+ if (!ev->num)
return;
if (hci_dev_test_flag(hdev, HCI_PERIODIC_INQ))
@@ -4524,10 +4521,11 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,
hci_dev_lock(hdev);
- if (skb->len == flex_array_size(ev, res2->info, ev->res2->num)) {
+ if (skb->len == array_size(ev->num,
+ sizeof(struct inquiry_info_rssi_pscan))) {
struct inquiry_info_rssi_pscan *info;
- for (i = 0; i < ev->res2->num; i++) {
+ for (i = 0; i < ev->num; i++) {
u32 flags;
info = hci_ev_skb_pull(hdev, skb,
@@ -4554,10 +4552,11 @@ static void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, void *edata,
info->dev_class, info->rssi,
flags, NULL, 0, NULL, 0);
}
- } else if (skb->len == flex_array_size(ev, res1->info, ev->res1->num)) {
+ } else if (skb->len == array_size(ev->num,
+ sizeof(struct inquiry_info_rssi))) {
struct inquiry_info_rssi *info;
- for (i = 0; i < ev->res1->num; i++) {
+ for (i = 0; i < ev->num; i++) {
u32 flags;
info = hci_ev_skb_pull(hdev, skb,