Replace memset with eth_zero_addr
v3 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>
Changes in v3-
Added appropriate header file to the second patch.
Changes in v2-
Dropped second patch in series because it breaks the build
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 | 13 +++++++------ drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-)
Signature · 1 line
2.1.4
PATCH RESEND v3 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>
---
Changes in v3-
No change.
Changes in v2-
No change
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 RESEND v3 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>
---
Changes in v3-
Added appropriate header files.
Changes in v2-
Had dropped this patch since the change without header file broke the build
drivers/staging/wilc1000/host_interface.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/host_interface.c +7 -6
@@ -6,6 +6,7 @@#include "coreconfigurator.h" #include "wilc_wlan_if.h" #include "wilc_msgqueue.h" +#include <linux/etherdevice.h> extern u8 connecting;
@@ -1950,7 +1951,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 +2207,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 +2330,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 +2792,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 +2834,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