All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: lorenzo@kernel.org
Cc: linux-wireless@vger.kernel.org
Subject: [bug report] mt76: mt7915: introduce 802.11ax multi-bss support
Date: Sat, 19 Mar 2022 12:05:01 +0300	[thread overview]
Message-ID: <20220319090501.GA5051@kili> (raw)

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])'

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

             reply	other threads:[~2022-03-19  9:05 UTC|newest]

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

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=20220319090501.GA5051@kili \
    --to=dan.carpenter@oracle.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.