relayd: update to the latest version, fixes some issues found by Coverity
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / 312-brcmfmac-check-all-combinations-when-setting-wiphy-s.patch
1 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
2 Date: Thu, 20 Aug 2015 00:16:42 +0200
3 Subject: [PATCH] brcmfmac: check all combinations when setting wiphy's
4 addresses
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Broadcom is working on better reflection of interface combinations. With
10 upcoming patches we may have 1st combination supporting less interfaces
11 than others.
12 To don't run out of addresses check all combinations to find the one
13 with the greatest max_interfaces value.
14
15 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
16 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
17 ---
18
19 --- a/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
20 +++ b/drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c
21 @@ -5786,7 +5786,9 @@ static void brcmf_wiphy_wowl_params(stru
22 static int brcmf_setup_wiphy(struct wiphy *wiphy, struct brcmf_if *ifp)
23 {
24 struct brcmf_pub *drvr = ifp->drvr;
25 + const struct ieee80211_iface_combination *combo;
26 struct ieee80211_supported_band *band;
27 + u16 max_interfaces = 0;
28 __le32 bandlist[3];
29 u32 n_bands;
30 int err, i;
31 @@ -5799,8 +5801,13 @@ static int brcmf_setup_wiphy(struct wiph
32 if (err)
33 return err;
34
35 - for (i = 0; i < wiphy->iface_combinations->max_interfaces &&
36 - i < ARRAY_SIZE(drvr->addresses); i++) {
37 + for (i = 0, combo = wiphy->iface_combinations;
38 + i < wiphy->n_iface_combinations; i++, combo++) {
39 + max_interfaces = max(max_interfaces, combo->max_interfaces);
40 + }
41 +
42 + for (i = 0; i < max_interfaces && i < ARRAY_SIZE(drvr->addresses);
43 + i++) {
44 u8 *addr = drvr->addresses[i].addr;
45
46 memcpy(addr, drvr->mac, ETH_ALEN);