All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Replace memset with eth_zero_addr
@ 2015-10-05  6:30 Shraddha Barke
  2015-10-05  6:30 ` [PATCH v3 1/2] Staging: wilc1000: wilc_wfi_cfgoperations: " Shraddha Barke
  2015-10-05  6:30 ` [PATCH v3 2/2] Staging: wilc1000: host_interface: " Shraddha Barke
  0 siblings, 2 replies; 8+ messages in thread
From: Shraddha Barke @ 2015-10-05  6:30 UTC (permalink / raw)
  To: outreachy-kernel

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(-)

-- 
2.1.4



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3 1/2] Staging: wilc1000: wilc_wfi_cfgoperations: Replace memset with eth_zero_addr
  2015-10-05  6:30 [PATCH v3 0/2] Replace memset with eth_zero_addr Shraddha Barke
@ 2015-10-05  6:30 ` Shraddha Barke
  2015-10-05  9:53   ` [Outreachy kernel] " Greg KH
  2015-10-05  6:30 ` [PATCH v3 2/2] Staging: wilc1000: host_interface: " Shraddha Barke
  1 sibling, 1 reply; 8+ messages in thread
From: Shraddha Barke @ 2015-10-05  6:30 UTC (permalink / raw)
  To: outreachy-kernel

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>

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
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(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 04838f1..7cf39b29 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -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)
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v3 2/2] Staging: wilc1000: host_interface: Replace memset with eth_zero_addr
  2015-10-05  6:30 [PATCH v3 0/2] Replace memset with eth_zero_addr Shraddha Barke
  2015-10-05  6:30 ` [PATCH v3 1/2] Staging: wilc1000: wilc_wfi_cfgoperations: " Shraddha Barke
@ 2015-10-05  6:30 ` Shraddha Barke
  1 sibling, 0 replies; 8+ messages in thread
From: Shraddha Barke @ 2015-10-05  6:30 UTC (permalink / raw)
  To: outreachy-kernel

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>

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
Changes in v3-
 Added appropriate header file

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(-)

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 39d72ac..1ad1526 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -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 */
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [Outreachy kernel] [PATCH v3 1/2] Staging: wilc1000: wilc_wfi_cfgoperations: Replace memset with eth_zero_addr
  2015-10-05  6:30 ` [PATCH v3 1/2] Staging: wilc1000: wilc_wfi_cfgoperations: " Shraddha Barke
@ 2015-10-05  9:53   ` Greg KH
  2015-10-05 10:28     ` Julia Lawall
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2015-10-05  9:53 UTC (permalink / raw)
  To: Shraddha Barke; +Cc: outreachy-kernel

On Mon, Oct 05, 2015 at 12:00:33PM +0530, Shraddha Barke wrote:
> Use eth_zero_addr to assign the zero address to the given address
> array instead of memset when second argument is address of zero.

How do you know that this is safe to do?  You need to document the heck
out of this and why you know this is ok.  See other patches that do this
for examples of what you need to do.

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Outreachy kernel] [PATCH v3 1/2] Staging: wilc1000: wilc_wfi_cfgoperations: Replace memset with eth_zero_addr
  2015-10-05  9:53   ` [Outreachy kernel] " Greg KH
@ 2015-10-05 10:28     ` Julia Lawall
  2015-10-05 10:44       ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2015-10-05 10:28 UTC (permalink / raw)
  To: Greg KH; +Cc: Shraddha Barke, outreachy-kernel

On Mon, 5 Oct 2015, Greg KH wrote:

> On Mon, Oct 05, 2015 at 12:00:33PM +0530, Shraddha Barke wrote:
> > Use eth_zero_addr to assign the zero address to the given address
> > array instead of memset when second argument is address of zero.
>
> How do you know that this is safe to do?  You need to document the heck
> out of this and why you know this is ok.  See other patches that do this
> for examples of what you need to do.

This one is just a memset, so I guess there are no constraints on is use?

julia


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Outreachy kernel] [PATCH v3 1/2] Staging: wilc1000: wilc_wfi_cfgoperations: Replace memset with eth_zero_addr
  2015-10-05 10:28     ` Julia Lawall
@ 2015-10-05 10:44       ` Greg KH
  2015-10-05 10:49         ` Julia Lawall
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2015-10-05 10:44 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Shraddha Barke, outreachy-kernel

On Mon, Oct 05, 2015 at 11:28:27AM +0100, Julia Lawall wrote:
> On Mon, 5 Oct 2015, Greg KH wrote:
> 
> > On Mon, Oct 05, 2015 at 12:00:33PM +0530, Shraddha Barke wrote:
> > > Use eth_zero_addr to assign the zero address to the given address
> > > array instead of memset when second argument is address of zero.
> >
> > How do you know that this is safe to do?  You need to document the heck
> > out of this and why you know this is ok.  See other patches that do this
> > for examples of what you need to do.
> 
> This one is just a memset, so I guess there are no constraints on is use?

I do not know, I thought the constraints were there for all eth_*
function calls.

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Outreachy kernel] [PATCH v3 1/2] Staging: wilc1000: wilc_wfi_cfgoperations: Replace memset with eth_zero_addr
  2015-10-05 10:44       ` Greg KH
@ 2015-10-05 10:49         ` Julia Lawall
  2015-10-05 11:06           ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2015-10-05 10:49 UTC (permalink / raw)
  To: Greg KH; +Cc: Julia Lawall, Shraddha Barke, outreachy-kernel

On Mon, 5 Oct 2015, Greg KH wrote:

> On Mon, Oct 05, 2015 at 11:28:27AM +0100, Julia Lawall wrote:
> > On Mon, 5 Oct 2015, Greg KH wrote:
> >
> > > On Mon, Oct 05, 2015 at 12:00:33PM +0530, Shraddha Barke wrote:
> > > > Use eth_zero_addr to assign the zero address to the given address
> > > > array instead of memset when second argument is address of zero.
> > >
> > > How do you know that this is safe to do?  You need to document the heck
> > > out of this and why you know this is ok.  See other patches that do this
> > > for examples of what you need to do.
> >
> > This one is just a memset, so I guess there are no constraints on is use?
>
> I do not know, I thought the constraints were there for all eth_*
> function calls.

The definition is just:

244 static inline void eth_zero_addr(u8 *addr)
245 {
246         memset(addr, 0x00, ETH_ALEN);
247 }

julia


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Outreachy kernel] [PATCH v3 1/2] Staging: wilc1000: wilc_wfi_cfgoperations: Replace memset with eth_zero_addr
  2015-10-05 10:49         ` Julia Lawall
@ 2015-10-05 11:06           ` Greg KH
  0 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2015-10-05 11:06 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Shraddha Barke, outreachy-kernel

On Mon, Oct 05, 2015 at 11:49:24AM +0100, Julia Lawall wrote:
> On Mon, 5 Oct 2015, Greg KH wrote:
> 
> > On Mon, Oct 05, 2015 at 11:28:27AM +0100, Julia Lawall wrote:
> > > On Mon, 5 Oct 2015, Greg KH wrote:
> > >
> > > > On Mon, Oct 05, 2015 at 12:00:33PM +0530, Shraddha Barke wrote:
> > > > > Use eth_zero_addr to assign the zero address to the given address
> > > > > array instead of memset when second argument is address of zero.
> > > >
> > > > How do you know that this is safe to do?  You need to document the heck
> > > > out of this and why you know this is ok.  See other patches that do this
> > > > for examples of what you need to do.
> > >
> > > This one is just a memset, so I guess there are no constraints on is use?
> >
> > I do not know, I thought the constraints were there for all eth_*
> > function calls.
> 
> The definition is just:
> 
> 244 static inline void eth_zero_addr(u8 *addr)
> 245 {
> 246         memset(addr, 0x00, ETH_ALEN);
> 247 }

Ah, didn't know that, nevermind then.

Shraddha, can you please resend this series?

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-10-05 11:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-05  6:30 [PATCH v3 0/2] Replace memset with eth_zero_addr Shraddha Barke
2015-10-05  6:30 ` [PATCH v3 1/2] Staging: wilc1000: wilc_wfi_cfgoperations: " Shraddha Barke
2015-10-05  9:53   ` [Outreachy kernel] " Greg KH
2015-10-05 10:28     ` Julia Lawall
2015-10-05 10:44       ` Greg KH
2015-10-05 10:49         ` Julia Lawall
2015-10-05 11:06           ` Greg KH
2015-10-05  6:30 ` [PATCH v3 2/2] Staging: wilc1000: host_interface: " Shraddha Barke

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.