staging: rtl8192e: using random_ether_addr() to generate random MAC
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Tue, 21 Aug 2012 08:38:45 +0000 (16:38 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 4 Sep 2012 21:11:28 +0000 (14:11 -0700)
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>
drivers/staging/rtl8192e/rtllib_softmac.c

index 8027ceb53c58cdf22ce0802785e4bee2fdab7799..99e907d462243e09727dbfa8009dee347721fb68 100644 (file)
@@ -2620,13 +2620,7 @@ void rtllib_wake_all_queues(struct rtllib_device *ieee)
 inline void rtllib_randomize_cell(struct rtllib_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 */