From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@01.org, Luca Coelho <luca@coelho.fi>
Cc: kbuild-all@01.org, johannes@sipsolutions.net,
linux-wireless@vger.kernel.org,
Sara Sharon <sara.sharon@intel.com>,
Luca Coelho <luciano.coelho@intel.com>
Subject: Re: [PATCH 09/11] cfg80211: support profile split between elements
Date: Tue, 19 Mar 2019 12:06:03 +0300 [thread overview]
Message-ID: <20190319090603.GM2227@kadam> (raw)
In-Reply-To: <20190315153907.16192-10-luca@coelho.fi>
Hi Luca,
Thank you for the patch! Perhaps something to improve:
url: https://github.com/0day-ci/linux/commits/Luca-Coelho/mac80211-Increase-MAX_MSG_LEN/20190316-083719
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
smatch warnings:
net/wireless/scan.c:1610 cfg80211_parse_mbssid_data() warn: should '1 << (mbssid_index_ie[2])' be a 64 bit type?
# https://github.com/0day-ci/linux/commit/e28e850d09f80732c1e9c04e0079c4e40f23ef7d
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout e28e850d09f80732c1e9c04e0079c4e40f23ef7d
vim +1610 net/wireless/scan.c
e28e850d Sara Sharon 2019-03-15 1530
0b8fb823 Peng Xu 2019-01-21 1531 static void cfg80211_parse_mbssid_data(struct wiphy *wiphy,
0b8fb823 Peng Xu 2019-01-21 1532 struct cfg80211_inform_bss *data,
0b8fb823 Peng Xu 2019-01-21 1533 enum cfg80211_bss_frame_type ftype,
0b8fb823 Peng Xu 2019-01-21 1534 const u8 *bssid, u64 tsf,
0b8fb823 Peng Xu 2019-01-21 1535 u16 beacon_interval, const u8 *ie,
0b8fb823 Peng Xu 2019-01-21 1536 size_t ielen,
0cd01efb Sara Sharon 2019-01-22 1537 struct cfg80211_non_tx_bss *non_tx_data,
0b8fb823 Peng Xu 2019-01-21 1538 gfp_t gfp)
0b8fb823 Peng Xu 2019-01-21 1539 {
1c8745f3 Johannes Berg 2019-02-07 1540 const u8 *mbssid_index_ie;
1c8745f3 Johannes Berg 2019-02-07 1541 const struct element *elem, *sub;
1c8745f3 Johannes Berg 2019-02-07 1542 size_t new_ie_len;
0b8fb823 Peng Xu 2019-01-21 1543 u8 new_bssid[ETH_ALEN];
e28e850d Sara Sharon 2019-03-15 1544 u8 *new_ie, *profile;
e28e850d Sara Sharon 2019-03-15 1545 u64 seen_indices = 0;
0b8fb823 Peng Xu 2019-01-21 1546 u16 capability;
0b8fb823 Peng Xu 2019-01-21 1547 struct cfg80211_bss *bss;
0b8fb823 Peng Xu 2019-01-21 1548
0cd01efb Sara Sharon 2019-01-22 1549 if (!non_tx_data)
0b8fb823 Peng Xu 2019-01-21 1550 return;
0b8fb823 Peng Xu 2019-01-21 1551 if (!cfg80211_find_ie(WLAN_EID_MULTIPLE_BSSID, ie, ielen))
0b8fb823 Peng Xu 2019-01-21 1552 return;
213ed579 Sara Sharon 2019-01-16 1553 if (!wiphy->support_mbssid)
213ed579 Sara Sharon 2019-01-16 1554 return;
213ed579 Sara Sharon 2019-01-16 1555 if (wiphy->support_only_he_mbssid &&
213ed579 Sara Sharon 2019-01-16 1556 !cfg80211_find_ext_ie(WLAN_EID_EXT_HE_CAPABILITY, ie, ielen))
213ed579 Sara Sharon 2019-01-16 1557 return;
0b8fb823 Peng Xu 2019-01-21 1558
0b8fb823 Peng Xu 2019-01-21 1559 new_ie = kmalloc(IEEE80211_MAX_DATA_LEN, gfp);
0b8fb823 Peng Xu 2019-01-21 1560 if (!new_ie)
0b8fb823 Peng Xu 2019-01-21 1561 return;
0b8fb823 Peng Xu 2019-01-21 1562
e28e850d Sara Sharon 2019-03-15 1563 profile = kmalloc(ielen, gfp);
e28e850d Sara Sharon 2019-03-15 1564 if (!profile)
e28e850d Sara Sharon 2019-03-15 1565 goto out;
e28e850d Sara Sharon 2019-03-15 1566
1c8745f3 Johannes Berg 2019-02-07 1567 for_each_element_id(elem, WLAN_EID_MULTIPLE_BSSID, ie, ielen) {
1c8745f3 Johannes Berg 2019-02-07 1568 if (elem->datalen < 4)
1c8745f3 Johannes Berg 2019-02-07 1569 continue;
1c8745f3 Johannes Berg 2019-02-07 1570 for_each_element(sub, elem->data + 1, elem->datalen - 1) {
e28e850d Sara Sharon 2019-03-15 1571 u8 profile_len;
e28e850d Sara Sharon 2019-03-15 1572
1c8745f3 Johannes Berg 2019-02-07 1573 if (sub->id != 0 || sub->datalen < 4) {
0b8fb823 Peng Xu 2019-01-21 1574 /* not a valid BSS profile */
0b8fb823 Peng Xu 2019-01-21 1575 continue;
0b8fb823 Peng Xu 2019-01-21 1576 }
0b8fb823 Peng Xu 2019-01-21 1577
1c8745f3 Johannes Berg 2019-02-07 1578 if (sub->data[0] != WLAN_EID_NON_TX_BSSID_CAP ||
1c8745f3 Johannes Berg 2019-02-07 1579 sub->data[1] != 2) {
0b8fb823 Peng Xu 2019-01-21 1580 /* The first element within the Nontransmitted
0b8fb823 Peng Xu 2019-01-21 1581 * BSSID Profile is not the Nontransmitted
0b8fb823 Peng Xu 2019-01-21 1582 * BSSID Capability element.
0b8fb823 Peng Xu 2019-01-21 1583 */
0b8fb823 Peng Xu 2019-01-21 1584 continue;
0b8fb823 Peng Xu 2019-01-21 1585 }
0b8fb823 Peng Xu 2019-01-21 1586
e28e850d Sara Sharon 2019-03-15 1587 memset(profile, 0, ielen);
e28e850d Sara Sharon 2019-03-15 1588 profile_len = cfg80211_merge_profile(ie, ielen,
e28e850d Sara Sharon 2019-03-15 1589 elem,
e28e850d Sara Sharon 2019-03-15 1590 sub,
e28e850d Sara Sharon 2019-03-15 1591 &profile,
e28e850d Sara Sharon 2019-03-15 1592 ielen);
e28e850d Sara Sharon 2019-03-15 1593
0b8fb823 Peng Xu 2019-01-21 1594 /* found a Nontransmitted BSSID Profile */
0b8fb823 Peng Xu 2019-01-21 1595 mbssid_index_ie = cfg80211_find_ie
0b8fb823 Peng Xu 2019-01-21 1596 (WLAN_EID_MULTI_BSSID_IDX,
e28e850d Sara Sharon 2019-03-15 1597 profile, profile_len);
0b8fb823 Peng Xu 2019-01-21 1598 if (!mbssid_index_ie || mbssid_index_ie[1] < 1 ||
e28e850d Sara Sharon 2019-03-15 1599 mbssid_index_ie[2] == 0 ||
e28e850d Sara Sharon 2019-03-15 1600 mbssid_index_ie[2] > 46) {
0b8fb823 Peng Xu 2019-01-21 1601 /* No valid Multiple BSSID-Index element */
0b8fb823 Peng Xu 2019-01-21 1602 continue;
0b8fb823 Peng Xu 2019-01-21 1603 }
0b8fb823 Peng Xu 2019-01-21 1604
e28e850d Sara Sharon 2019-03-15 1605 if (seen_indices & BIT(mbssid_index_ie[2]))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I should fix Smatch to generate a warning here as well...
e28e850d Sara Sharon 2019-03-15 1606 /* We don't support legacy split of a profile */
e28e850d Sara Sharon 2019-03-15 1607 net_dbg_ratelimited("Partial info for BSSID index %d\n",
e28e850d Sara Sharon 2019-03-15 1608 mbssid_index_ie[2]);
e28e850d Sara Sharon 2019-03-15 1609
e28e850d Sara Sharon 2019-03-15 @1610 seen_indices |= BIT(mbssid_index_ie[2]);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
e28e850d Sara Sharon 2019-03-15 1611
0cd01efb Sara Sharon 2019-01-22 1612 non_tx_data->bssid_index = mbssid_index_ie[2];
0cd01efb Sara Sharon 2019-01-22 1613 non_tx_data->max_bssid_indicator = elem->data[0];
0cd01efb Sara Sharon 2019-01-22 1614
0cd01efb Sara Sharon 2019-01-22 1615 cfg80211_gen_new_bssid(bssid,
0cd01efb Sara Sharon 2019-01-22 1616 non_tx_data->max_bssid_indicator,
0cd01efb Sara Sharon 2019-01-22 1617 non_tx_data->bssid_index,
0b8fb823 Peng Xu 2019-01-21 1618 new_bssid);
0b8fb823 Peng Xu 2019-01-21 1619 memset(new_ie, 0, IEEE80211_MAX_DATA_LEN);
e28e850d Sara Sharon 2019-03-15 1620 new_ie_len = cfg80211_gen_new_ie(ie, ielen,
e28e850d Sara Sharon 2019-03-15 1621 profile,
e28e850d Sara Sharon 2019-03-15 1622 profile_len, new_ie,
0b8fb823 Peng Xu 2019-01-21 1623 gfp);
0b8fb823 Peng Xu 2019-01-21 1624 if (!new_ie_len)
0b8fb823 Peng Xu 2019-01-21 1625 continue;
0b8fb823 Peng Xu 2019-01-21 1626
e28e850d Sara Sharon 2019-03-15 1627 capability = get_unaligned_le16(profile + 2);
0b8fb823 Peng Xu 2019-01-21 1628 bss = cfg80211_inform_single_bss_data(wiphy, data,
0b8fb823 Peng Xu 2019-01-21 1629 ftype,
0b8fb823 Peng Xu 2019-01-21 1630 new_bssid, tsf,
0b8fb823 Peng Xu 2019-01-21 1631 capability,
0b8fb823 Peng Xu 2019-01-21 1632 beacon_interval,
0b8fb823 Peng Xu 2019-01-21 1633 new_ie,
0b8fb823 Peng Xu 2019-01-21 1634 new_ie_len,
0cd01efb Sara Sharon 2019-01-22 1635 non_tx_data,
0cd01efb Sara Sharon 2019-01-22 1636 gfp);
0b8fb823 Peng Xu 2019-01-21 1637 if (!bss)
0b8fb823 Peng Xu 2019-01-21 1638 break;
0b8fb823 Peng Xu 2019-01-21 1639 cfg80211_put_bss(wiphy, bss);
0b8fb823 Peng Xu 2019-01-21 1640 }
0b8fb823 Peng Xu 2019-01-21 1641 }
0b8fb823 Peng Xu 2019-01-21 1642
e28e850d Sara Sharon 2019-03-15 1643 out:
0b8fb823 Peng Xu 2019-01-21 1644 kfree(new_ie);
e28e850d Sara Sharon 2019-03-15 1645 kfree(profile);
0b8fb823 Peng Xu 2019-01-21 1646 }
0b8fb823 Peng Xu 2019-01-21 1647
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
next prev parent reply other threads:[~2019-03-19 9:06 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-15 15:38 [PATCH 00/11] cfg80211/mac80211 patches from our internal tree 2019-03-15 Luca Coelho
2019-03-15 15:38 ` [PATCH 01/11] mac80211: Increase MAX_MSG_LEN Luca Coelho
2019-03-15 15:38 ` [PATCH 02/11] nl80211: increase NL80211_MAX_SUPP_REG_RULES Luca Coelho
2019-03-15 15:38 ` [PATCH 03/11] nl80211: copy the length of dst of src in nl80211_notify_radar_detection() Luca Coelho
2019-03-23 12:34 ` Johannes Berg
2019-04-17 6:34 ` [PATCH v2 03/11] nl80211: do a struct assignment to radar_chandef instead of memcpy() Luca Coelho
2019-03-15 15:39 ` [PATCH 04/11] cfg80211: Handle WMM rules in regulatory domain intersection Luca Coelho
2019-03-15 15:39 ` [PATCH 05/11] mac80211_hwsim: set p2p device interface support indication Luca Coelho
2019-03-18 10:56 ` Arend Van Spriel
2019-03-15 15:39 ` [PATCH 06/11] cfg80211: don't skip multi-bssid index element Luca Coelho
2019-03-26 4:27 ` [cfg80211] 83db2c9ebd: hwsim.scan_multi_bssid_check_ie.fail kernel test robot
2019-03-15 15:39 ` [PATCH 07/11] cfg80211: support non-inheritance element Luca Coelho
2019-03-15 15:39 ` [PATCH 08/11] mac80211: " Luca Coelho
2019-03-15 15:39 ` [PATCH 09/11] cfg80211: support profile split between elements Luca Coelho
2019-03-19 9:06 ` Dan Carpenter [this message]
2019-03-15 15:39 ` [PATCH 10/11] mac80211: " Luca Coelho
2019-03-15 15:39 ` [PATCH 11/11] ieee80211: update HE IEs to D4.0 spec Luca Coelho
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=20190319090603.GM2227@kadam \
--to=dan.carpenter@oracle.com \
--cc=johannes@sipsolutions.net \
--cc=kbuild-all@01.org \
--cc=kbuild@01.org \
--cc=linux-wireless@vger.kernel.org \
--cc=luca@coelho.fi \
--cc=luciano.coelho@intel.com \
--cc=sara.sharon@intel.com \
/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