Skip to content

Commit

Permalink
Staging: rtl8192u: using random_ether_addr() to generate random MAC
Browse files Browse the repository at this point in the history
Using random_ether_addr() to generate a random Ethernet
address (MAC) that is not multicast and has the local
assigned bit set. Not need to duplicating its implementation.

spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Wei Yongjun authored and Greg Kroah-Hartman committed Sep 4, 2012
1 parent 71cd791 commit 37905ae
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -2288,13 +2288,7 @@ void ieee80211_stop_queue(struct ieee80211_device *ieee)
inline void ieee80211_randomize_cell(struct ieee80211_device *ieee)
{

get_random_bytes(ieee->current_network.bssid, ETH_ALEN);

/* an IBSS cell address must have the two less significant
* bits of the first byte = 2
*/
ieee->current_network.bssid[0] &= ~0x01;
ieee->current_network.bssid[0] |= 0x02;
random_ether_addr(ieee->current_network.bssid);
}

/* called in user context only */
Expand Down

0 comments on commit 37905ae

Please sign in to comment.