Replace memset with eth_zero_addr
cover Replace memset with eth_zero_addr
These patches replace memset with eth_zero_addr. Change is made using Coccinelle script -
// <smpl>
@eth_zero_addr@
expression e;
@@
-memset(e,0x00,ETH_ALEN);
+eth_zero_addr(e);
// </smpl>
Shraddha Barke (2):
Staging: wilc1000: wilc_wfi_cfgoperations: Replace memset with
eth_zero_addr
Staging: wilc1000: host_interface: Replace memset with eth_zero_addr
drivers/staging/wilc1000/host_interface.c | 12 ++++++------ drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-)
Signature · 1 line
2.1.4
PATCH 1/2 Staging: wilc1000: wilc_wfi_cfgoperations: Replace memset with eth_zero_addr
Use eth_zero_addr to assign the zero address to the given address array instead of memset when second argument is address of zero.
The Coccinelle patch used -
// <smpl>
@eth_zero_addr@
expression e;
@@
-memset(e,0x00,ETH_ALEN);
+eth_zero_addr(e);
// </smpl>
--- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +3 -3
@@ -562,7 +562,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);/*Invalidate u8WLANChannel value on wlan0 disconnect*/ if (!pstrWFIDrv->u8P2PConnect)
@@ -619,9 +619,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);/*Invalidate u8WLANChannel value on wlan0 disconnect*/ if (!pstrWFIDrv->u8P2PConnect)
Signature · 1 line
2.1.4
PATCH 2/2 Staging: wilc1000: host_interface: Replace memset with eth_zero_addr
In reply to Shraddha BarkeUse eth_zero_addr to assign the zero address to the given address array instead of memset when second argument is address of zero.
The Coccinelle patch used -
// <smpl>
@eth_zero_addr@
expression e;
@@
-memset(e,0x00,ETH_ALEN);
+eth_zero_addr(e);
// </smpl>
--- drivers/staging/wilc1000/host_interface.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/host_interface.c +6 -6
@@ -1950,7 +1950,7 @@ static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs =NULL ; } -memset (u8ConnectedSSID,0 ,ETH_ALEN ); +eth_zero_addr (u8ConnectedSSID);/*Freeing flushed join request params on connect timeout*/ if (gu8FlushedJoinReq !=NULL && gu8FlushedJoinReqDrvHandler == drvHandler) {kfree (gu8FlushedJoinReq);
@@ -2206,11 +2206,11 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler,if ((u8MacStatus ==MAC_CONNECTED ) && (strConnectInfo.u16ConnectStatus !=SUCCESSFUL_STATUSCODE )) {PRINT_ER ("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n" ); -memset (u8ConnectedSSID,0 ,ETH_ALEN ); +eth_zero_addr (u8ConnectedSSID); }else if (u8MacStatus ==MAC_DISCONNECTED ) {PRINT_ER ("Received MAC status is MAC_DISCONNECTED\n" ); -memset (u8ConnectedSSID,0 ,ETH_ALEN ); +eth_zero_addr (u8ConnectedSSID); }/* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */
@@ -2329,7 +2329,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler,PRINT_ER ("Connect result callback function is NULL\n" ); } -memset (pstrWFIDrv->au8AssociatedBSSID,0 ,ETH_ALEN ); +eth_zero_addr (pstrWFIDrv->au8AssociatedBSSID);/* Deallocation */
@@ -2791,7 +2791,7 @@ static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) g_obtainingIP = false;host_int_set_power_mgmt (pstrWFIDrv,0 ,0 ); -memset (u8ConnectedSSID,0 ,ETH_ALEN ); +eth_zero_addr (u8ConnectedSSID); s32Error =send_config_pkt (SET_CFG , &strWID,1 , false,get_id_from_handler (pstrWFIDrv));
@@ -2833,7 +2833,7 @@ static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) pstrWFIDrv->enuHostIFstate =HOST_IF_IDLE ; -memset (pstrWFIDrv->au8AssociatedBSSID,0 ,ETH_ALEN ); +eth_zero_addr (pstrWFIDrv->au8AssociatedBSSID);/* Deallocation */
Signature · 1 line
2.1.4
Re: [Outreachy kernel] [PATCH 2/2] Staging: wilc1000: host_interface: Replace memset with eth_zero_addr
Quoted 14 lines · Shraddha Barke
Use
eth_zero_addrto assign the zero address to the given address array instead of memset when second argument is address of zero.The Coccinelle patch used -
// <smpl>
@eth_zero_addr@
expression e;
@@(quoted diff) +1
-1-memset(e,0x00,ETH_ALEN); +eth_zero_addr(e);// </smpl>
Quoted 2 lines
Signed-off-by Shraddha Barke <[email protected]>---
Please always test build your patch. Build fails with this patch.
drivers/staging/wilc1000/host_interface.c: In function ‘Handle_ConnectTimeout’:drivers/staging/wilc1000/host_interface.c:1953:2: error: implicit declaration of function ‘eth_zero_addr’
regards
sudip