From: Beni Lev <beni.lev@xxxxxxxxx> Instead of passing the whole attributes array, pass specific attributes for the mac address and the mask. Signed-off-by: Beni Lev <beni.lev@xxxxxxxxx> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> --- net/wireless/nl80211.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 72de6989dd12..243c6cbc99ab 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -5753,12 +5753,13 @@ static int validate_scan_freqs(struct nlattr *freqs) return n_channels; } -static int nl80211_parse_random_mac(struct nlattr **attrs, +static int nl80211_parse_random_mac(struct nlattr *mac_attr, + struct nlattr *mac_mask_attr, u8 *mac_addr, u8 *mac_addr_mask) { int i; - if (!attrs[NL80211_ATTR_MAC] && !attrs[NL80211_ATTR_MAC_MASK]) { + if (!mac_attr && !mac_mask_attr) { eth_zero_addr(mac_addr); eth_zero_addr(mac_addr_mask); mac_addr[0] = 0x2; @@ -5768,11 +5769,11 @@ static int nl80211_parse_random_mac(struct nlattr **attrs, } /* need both or none */ - if (!attrs[NL80211_ATTR_MAC] || !attrs[NL80211_ATTR_MAC_MASK]) + if (!mac_attr || !mac_mask_attr) return -EINVAL; - memcpy(mac_addr, nla_data(attrs[NL80211_ATTR_MAC]), ETH_ALEN); - memcpy(mac_addr_mask, nla_data(attrs[NL80211_ATTR_MAC_MASK]), ETH_ALEN); + memcpy(mac_addr, nla_data(mac_attr), ETH_ALEN); + memcpy(mac_addr_mask, nla_data(mac_mask_attr), ETH_ALEN); /* don't allow or configure an mcast address */ if (!is_multicast_ether_addr(mac_addr_mask) || @@ -5980,9 +5981,10 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) goto out_free; } - err = nl80211_parse_random_mac(info->attrs, - request->mac_addr, - request->mac_addr_mask); + err = nl80211_parse_random_mac( + info->attrs[NL80211_ATTR_MAC], + info->attrs[NL80211_ATTR_MAC_MASK], + request->mac_addr, request->mac_addr_mask); if (err) goto out_free; } @@ -6416,8 +6418,9 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, goto out_free; } - err = nl80211_parse_random_mac(attrs, request->mac_addr, - request->mac_addr_mask); + err = nl80211_parse_random_mac(attrs[NL80211_ATTR_MAC], + attrs[NL80211_ATTR_MAC_MASK], request->mac_addr, + request->mac_addr_mask); if (err) goto out_free; } -- 2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html