Skip to contentSkip to conversation

Staging: wilc1000: wilc_wfi_cfgoperations.c: replace memset(x,0,ETH_ALEN)

PATCH In review Shraddha Barke 2 participants 2 messages Sep 12, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: wilc1000: wilc_wfi_cfgoperations.c: replace memset(x,0,ETH_ALEN)

eth_zero_addr() is a wrapper function for memset if 0 is going to be assigned to a mac address. The aforementioned function replaces memset.

Changes were done using Coccinelle

@eth_zero_addr@
expression e;
@@

-memset(e,0x00,\(6\|ETH_ALEN\));
+eth_zero_addr(e);

Build tested it.

---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +3 -3
index a6edc97..68482d95 100644
@@ -575,7 +575,7 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent,
 			 *  = SUCCESSFUL_STATUSCODE, while mac status is MAC_DISCONNECTED (which means something wrong happened) */
 			u16ConnectStatus = WLAN_STATUS_UNSPECIFIED_FAILURE;
 			linux_wlan_set_bssid(priv->dev, NullBssid);
-			memset(u8ConnectedSSID, 0, ETH_ALEN);
+			eth_zero_addr(u8ConnectedSSID);
 
 			/*BugID_5457*/
 			/*Invalidate u8WLANChannel value on wlan0 disconnect*/
@@ -641,9 +641,9 @@ static void CfgConnectResult(tenuConnDisconnEvent enuConnDisconnEvent,
 		u8P2Plocalrandom = 0x01;
 		u8P2Precvrandom = 0x00;
 		bWilc_ie = false;
-		memset(priv->au8AssociatedBss, 0, ETH_ALEN);
+		eth_zero_addr(priv->au8AssociatedBss);
 		linux_wlan_set_bssid(priv->dev, NullBssid);
-		memset(u8ConnectedSSID, 0, ETH_ALEN);
+		eth_zero_addr(u8ConnectedSSID);
 
 		/*BugID_5457*/
 		/*Invalidate u8WLANChannel value on wlan0 disconnect*/
Signature · 1 line
2.1.4
#1 lore raw
Quoted 13 lines · Shraddha Barke

eth_zero_addr() is a wrapper function for memset if 0 is going to be assigned to a mac address. The aforementioned function replaces memset.

Changes were done using Coccinelle

@eth_zero_addr@
expression e;
@@

(quoted diff) +1 -1
-memset(e,0x00,\(6\|ETH_ALEN\));
+eth_zero_addr(e);
Quoted 1 line

Build tested it.

You need to do much more to prove that this is a safe change than just test build it, sorry.