Linux wireless drivers development
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [bug report] mt76: mt7915: introduce 802.11ax multi-bss support
Date: Sat, 19 Mar 2022 12:21:27 +0100	[thread overview]
Message-ID: <YjW8t8N7T6EgGiOe@lore-desk> (raw)
In-Reply-To: <20220319090501.GA5051@kili>

[-- Attachment #1: Type: text/plain, Size: 3200 bytes --]

> Hello Lorenzo Bianconi,
> 
> The patch 6b7f9aff7c67: "mt76: mt7915: introduce 802.11ax multi-bss
> support" from Mar 15, 2022, leads to the following Smatch static
> checker warning:
> 
> 	drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:1872 mt7915_mcu_beacon_mbss()
> 	error: undefined (user controlled) shift '(((1))) << (data[2])'

I do not think it is a real issue since bssid_index is supposed to be limited
by mbssid_max_interfaces (set to 16 for 7915), but I will add a check. Thanks.

Regards,
Lorenzo

> 
> drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
>     1828 static void
>     1829 mt7915_mcu_beacon_mbss(struct sk_buff *rskb, struct sk_buff *skb,
>     1830                        struct ieee80211_vif *vif, struct bss_info_bcn *bcn,
>     1831                        struct ieee80211_mutable_offsets *offs)
>     1832 {
>     1833         struct bss_info_bcn_mbss *mbss;
>     1834         const struct element *elem;
>     1835         struct tlv *tlv;
>     1836 
>     1837         if (!vif->bss_conf.bssid_indicator)
>     1838                 return;
>     1839 
>     1840         tlv = mt7915_mcu_add_nested_subtlv(rskb, BSS_INFO_BCN_MBSSID,
>     1841                                            sizeof(*mbss), &bcn->sub_ntlv,
>     1842                                            &bcn->len);
>     1843 
>     1844         mbss = (struct bss_info_bcn_mbss *)tlv;
>     1845         mbss->offset[0] = cpu_to_le16(offs->tim_offset);
>     1846         mbss->bitmap = cpu_to_le32(1);
>     1847 
>     1848         for_each_element_id(elem, WLAN_EID_MULTIPLE_BSSID,
>     1849                             &skb->data[offs->mbssid_off],
>     1850                             skb->len - offs->mbssid_off) {
>     1851                 const struct element *sub_elem;
>     1852 
>     1853                 if (elem->datalen < 2)
>     1854                         continue;
>     1855 
>     1856                 for_each_element(sub_elem, elem->data + 1, elem->datalen - 1) {
>     1857                         const u8 *data;
>     1858 
>     1859                         if (sub_elem->id || sub_elem->datalen < 4)
>     1860                                 continue; /* not a valid BSS profile */
>     1861 
>     1862                         /* Find WLAN_EID_MULTI_BSSID_IDX
>     1863                          * in the merged nontransmitted profile
>     1864                          */
>     1865                         data = cfg80211_find_ie(WLAN_EID_MULTI_BSSID_IDX,
>     1866                                                 sub_elem->data,
>     1867                                                 sub_elem->datalen);
>     1868                         if (!data || data[1] < 1 || !data[2])
> 
> This probably needs a "|| data[2] > 31" but maybe using a define?
> 
>     1869                                 continue;
>     1870 
>     1871                         mbss->offset[data[2]] = cpu_to_le16(data - skb->data);
> --> 1872                         mbss->bitmap |= cpu_to_le32(BIT(data[2]));
>     1873                 }
>     1874         }
>     1875 }
> 
> regards,
> dan carpenter

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2022-03-19 11:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-19  9:05 [bug report] mt76: mt7915: introduce 802.11ax multi-bss support Dan Carpenter
2022-03-19 11:21 ` Lorenzo Bianconi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YjW8t8N7T6EgGiOe@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox