All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4 v2] replace memset(x,0,ETH_ALEN) by eth_zero_addr(x)
@ 2015-03-03 14:01 Aya Mahfouz
  2015-03-03 14:03 ` [PATCH 1/4 v2] staging: rtl8192e: " Aya Mahfouz
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Aya Mahfouz @ 2015-03-03 14:01 UTC (permalink / raw)
  To: outreachy-kernel

Replaces all occurences of memset(x,0,ETH_ALEN) by eth_zero_addr(x).
In general,there are two inline functions that wrap memset. One is
eth_zero_addr when the assigned address is zero and the second is
eth_broadcast_addr when assigning a broadcast address to a variable.
Coccinelle was employed for the automation of the process and adding
the header linux/etherdevice.h if not added by default.

The set is resent because for some odd reason the first rule of the
coccinelle script is emptied by git when generating the patch.

Aya Mahfouz (4):
  staging: rtl8192e: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x)
  staging: rtl8192e: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x)
  staging: rtl8192u: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x)
  staging: rtl8192u: ieee80211: replace memset(x,0,ETH_ALEN) by
    eth_zero_addr(x)

 drivers/staging/rtl8192e/rtllib_softmac.c                 | 2 +-
 drivers/staging/rtl8192e/rtllib_softmac_wx.c              | 2 +-
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c    | 2 +-
 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
---

-- 
1.9.3


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz


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

* [PATCH 1/4 v2] staging: rtl8192e: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x)
  2015-03-03 14:01 [PATCH 0/4 v2] replace memset(x,0,ETH_ALEN) by eth_zero_addr(x) Aya Mahfouz
@ 2015-03-03 14:03 ` Aya Mahfouz
  2015-03-03 14:04 ` [PATCH 2/4 " Aya Mahfouz
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Aya Mahfouz @ 2015-03-03 14:03 UTC (permalink / raw)
  To: outreachy-kernel

eth_zero_addr() is a wrapper function for memset if 0 is going to
be assigned to a mac address. The replacement was done by the
following coccinelle script:

@header@
@@

#include <linux/etherdevice.h>

@eth_zero_addr@
expression e;
@@

-memset(e,0,ETH_ALEN);
+eth_zero_addr(e);

@eth_broadcast_addr@
identifier e;
@@

-memset(e,\(0xff\|0xFF\|255\),ETH_ALEN);
+eth_broadcast_addr(e);

@linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @
@@

+ #include <linux/etherdevice.h>
+

@special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @
@@

+
+ #include <linux/etherdevice.h>
+

@custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @
@@

+
+ #include <linux/etherdevice.h>

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
v2: made sure that the first rule in the script remains intact.

 drivers/staging/rtl8192e/rtllib_softmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index d992a75..16aef7c 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -3751,7 +3751,7 @@ void notify_wx_assoc_event(struct rtllib_device *ieee)
 
 		printk(KERN_INFO "%s(): Tell user space disconnected\n",
 		       __func__);
-		memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
+		eth_zero_addr(wrqu.ap_addr.sa_data);
 	}
 	wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL);
 }
-- 
1.9.3


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz


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

* [PATCH 2/4 v2] staging: rtl8192e: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x)
  2015-03-03 14:01 [PATCH 0/4 v2] replace memset(x,0,ETH_ALEN) by eth_zero_addr(x) Aya Mahfouz
  2015-03-03 14:03 ` [PATCH 1/4 v2] staging: rtl8192e: " Aya Mahfouz
@ 2015-03-03 14:04 ` Aya Mahfouz
  2015-03-03 14:06 ` [PATCH 3/4 v2] staging: rtl8192u: " Aya Mahfouz
  2015-03-03 14:08 ` [PATCH 4/4 v2] staging: rtl8192u: ieee80211: " Aya Mahfouz
  3 siblings, 0 replies; 5+ messages in thread
From: Aya Mahfouz @ 2015-03-03 14:04 UTC (permalink / raw)
  To: outreachy-kernel

eth_zero_addr() is a wrapper function for memset if 0 is going to
be assigned to a mac address. The replacement was done by the
following coccinelle script:

@header@
@@

#include <linux/etherdevice.h>

@eth_zero_addr@
expression e;
@@

-memset(e,0,ETH_ALEN);
+eth_zero_addr(e);

@eth_broadcast_addr@
identifier e;
@@

-memset(e,\(0xff\|0xFF\|255\),ETH_ALEN);
+eth_broadcast_addr(e);

@linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @
@@

+ #include <linux/etherdevice.h>
+

@special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @
@@

+
+ #include <linux/etherdevice.h>
+

@custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @
@@

+
+ #include <linux/etherdevice.h>

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
 drivers/staging/rtl8192e/rtllib_softmac_wx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
index 835f3d7..283ba8b 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
@@ -120,7 +120,7 @@ int rtllib_wx_get_wap(struct rtllib_device *ieee,
 		ieee->state != RTLLIB_LINKED_SCANNING &&
 		ieee->wap_set == 0)
 
-		memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
+		eth_zero_addr(wrqu->ap_addr.sa_data);
 	else
 		memcpy(wrqu->ap_addr.sa_data,
 		       ieee->current_network.bssid, ETH_ALEN);
-- 
1.9.3


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz


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

* [PATCH 3/4 v2] staging: rtl8192u: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x)
  2015-03-03 14:01 [PATCH 0/4 v2] replace memset(x,0,ETH_ALEN) by eth_zero_addr(x) Aya Mahfouz
  2015-03-03 14:03 ` [PATCH 1/4 v2] staging: rtl8192e: " Aya Mahfouz
  2015-03-03 14:04 ` [PATCH 2/4 " Aya Mahfouz
@ 2015-03-03 14:06 ` Aya Mahfouz
  2015-03-03 14:08 ` [PATCH 4/4 v2] staging: rtl8192u: ieee80211: " Aya Mahfouz
  3 siblings, 0 replies; 5+ messages in thread
From: Aya Mahfouz @ 2015-03-03 14:06 UTC (permalink / raw)
  To: outreachy-kernel

eth_zero_addr() is a wrapper function for memset if 0 is going to
be assigned to a mac address. The replacement was done by the
following coccinelle script:

@header@
@@

#include <linux/etherdevice.h>

@eth_zero_addr@
expression e;
@@

-memset(e,0,ETH_ALEN);
+eth_zero_addr(e);

@eth_broadcast_addr@
identifier e;
@@

-memset(e,\(0xff\|0xFF\|255\),ETH_ALEN);
+eth_broadcast_addr(e);

@linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @
@@

+ #include <linux/etherdevice.h>
+

@special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @
@@

+
+ #include <linux/etherdevice.h>
+

@custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @
@@

+
+ #include <linux/etherdevice.h>

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
v2: made sure that the first rule in the script remains intact.

 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
index 3a54071..3527edc 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
@@ -3208,7 +3208,7 @@ void notify_wx_assoc_event(struct ieee80211_device *ieee)
 	if (ieee->state == IEEE80211_LINKED)
 		memcpy(wrqu.ap_addr.sa_data, ieee->current_network.bssid, ETH_ALEN);
 	else
-		memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
+		eth_zero_addr(wrqu.ap_addr.sa_data);
 	wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL);
 }
 EXPORT_SYMBOL(notify_wx_assoc_event);
-- 
1.9.3


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz


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

* [PATCH 4/4 v2] staging: rtl8192u: ieee80211: replace memset(x,0,ETH_ALEN) by eth_zero_addr(x)
  2015-03-03 14:01 [PATCH 0/4 v2] replace memset(x,0,ETH_ALEN) by eth_zero_addr(x) Aya Mahfouz
                   ` (2 preceding siblings ...)
  2015-03-03 14:06 ` [PATCH 3/4 v2] staging: rtl8192u: " Aya Mahfouz
@ 2015-03-03 14:08 ` Aya Mahfouz
  3 siblings, 0 replies; 5+ messages in thread
From: Aya Mahfouz @ 2015-03-03 14:08 UTC (permalink / raw)
  To: outreachy-kernel

eth_zero_addr() is a wrapper function for memset if 0 is going to
be assigned to a mac address. The replacement was done by the
following coccinelle script:

@header@
@@

#include <linux/etherdevice.h>

@eth_zero_addr@
expression e;
@@

-memset(e,0,ETH_ALEN);
+eth_zero_addr(e);

@eth_broadcast_addr@
identifier e;
@@

-memset(e,\(0xff\|0xFF\|255\),ETH_ALEN);
+eth_broadcast_addr(e);

@linux_header depends on !header && (eth_zero_addr || eth_broadcast_addr) @
@@

+ #include <linux/etherdevice.h>
+

@special_header depends on !header && !linux_header && (eth_zero_addr || eth_broadcast_addr) @
@@

+
+ #include <linux/etherdevice.h>
+

@custom_header depends on !header && !linux_header && !special_header && (eth_zero_addr || eth_broadcast_addr) @
@@

+
+ #include <linux/etherdevice.h>

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
---
v2: made sure that the first rule in the script remains intact.

 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
index 644368d..dcfa5ab 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c
@@ -121,7 +121,7 @@ int ieee80211_wx_get_wap(struct ieee80211_device *ieee,
 		ieee->state != IEEE80211_LINKED_SCANNING &&
 		ieee->wap_set == 0)
 
-		memset(wrqu->ap_addr.sa_data, 0, ETH_ALEN);
+		eth_zero_addr(wrqu->ap_addr.sa_data);
 	else
 		memcpy(wrqu->ap_addr.sa_data,
 		       ieee->current_network.bssid, ETH_ALEN);
-- 
1.9.3


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz


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

end of thread, other threads:[~2015-03-03 14:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-03 14:01 [PATCH 0/4 v2] replace memset(x,0,ETH_ALEN) by eth_zero_addr(x) Aya Mahfouz
2015-03-03 14:03 ` [PATCH 1/4 v2] staging: rtl8192e: " Aya Mahfouz
2015-03-03 14:04 ` [PATCH 2/4 " Aya Mahfouz
2015-03-03 14:06 ` [PATCH 3/4 v2] staging: rtl8192u: " Aya Mahfouz
2015-03-03 14:08 ` [PATCH 4/4 v2] staging: rtl8192u: ieee80211: " Aya Mahfouz

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.