public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] Staging: rtl8712: Replace memcpy by ether_addr_copy
@ 2015-09-06 19:04 Shraddha Barke
  2015-09-06 19:04 ` [PATCH 2/3] Staging: rtl8192e: Replace memcpy by ethr_addr_copy Shraddha Barke
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Shraddha Barke @ 2015-09-06 19:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Larry Finger, Florian Schilhabel,
	Mateusz Kulikowski, Aya Mahfouz, Julia Lawall, Sudip Mukherjee,
	linux-kernel
  Cc: Shraddha Barke

This patch replaces memcpy by ethr_addr_copy

The change was made using Coccinelle

@@ expression e1, e2; @@
- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/rtl8712/rtl871x_mp_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c
index 77f01bf..76c1cfe 100644
--- a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c
+++ b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c
@@ -167,7 +167,7 @@ static int mp_start_test(struct _adapter *padapter)
 	int res = _SUCCESS;
 
 	/* 3 1. initialize a new struct wlan_bssid_ex */
-	memcpy(bssid.MacAddress, pmppriv->network_macaddr, ETH_ALEN);
+	ether_addr_copy(bssid.MacAddress, pmppriv->network_macaddr);
 	bssid.Ssid.SsidLength = 16;
 	memcpy(bssid.Ssid.Ssid, (unsigned char *)"mp_pseudo_adhoc",
 		bssid.Ssid.SsidLength);
-- 
2.1.4


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

* [PATCH 2/3] Staging: rtl8192e: Replace memcpy by ethr_addr_copy
  2015-09-06 19:04 [PATCH 1/3] Staging: rtl8712: Replace memcpy by ether_addr_copy Shraddha Barke
@ 2015-09-06 19:04 ` Shraddha Barke
  2015-09-06 19:38   ` Larry Finger
  2015-09-06 19:04 ` [PATCH 3/3] Staging: rtl8192u: r8192U_core.c: Replace memcpy with eth_addr_copy Shraddha Barke
  2015-09-06 19:37 ` [PATCH 1/3] Staging: rtl8712: Replace memcpy by ether_addr_copy Larry Finger
  2 siblings, 1 reply; 6+ messages in thread
From: Shraddha Barke @ 2015-09-06 19:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Larry Finger, Florian Schilhabel,
	Mateusz Kulikowski, Aya Mahfouz, Julia Lawall, Sudip Mukherjee,
	linux-kernel
  Cc: Shraddha Barke

The patch replaces memcpy with ethr_addr_copy

The changes were applied using the following coccinelle
rule:
@@ expression e1, e2; @@
- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/rtl8192e/rtllib_softmac_wx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
index 86f52ac..cf243fe 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
@@ -122,8 +122,8 @@ int rtllib_wx_get_wap(struct rtllib_device *ieee,
 
 		eth_zero_addr(wrqu->ap_addr.sa_data);
 	else
-		memcpy(wrqu->ap_addr.sa_data,
-		       ieee->current_network.bssid, ETH_ALEN);
+		ether_addr_copy(wrqu->ap_addr.sa_data,
+				ieee->current_network.bssid);
 
 	spin_unlock_irqrestore(&ieee->lock, flags);
 
-- 
2.1.4


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

* [PATCH 3/3] Staging: rtl8192u: r8192U_core.c: Replace memcpy with eth_addr_copy
  2015-09-06 19:04 [PATCH 1/3] Staging: rtl8712: Replace memcpy by ether_addr_copy Shraddha Barke
  2015-09-06 19:04 ` [PATCH 2/3] Staging: rtl8192e: Replace memcpy by ethr_addr_copy Shraddha Barke
@ 2015-09-06 19:04 ` Shraddha Barke
  2015-09-06 19:39   ` Larry Finger
  2015-09-06 19:37 ` [PATCH 1/3] Staging: rtl8712: Replace memcpy by ether_addr_copy Larry Finger
  2 siblings, 1 reply; 6+ messages in thread
From: Shraddha Barke @ 2015-09-06 19:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Larry Finger, Florian Schilhabel,
	Mateusz Kulikowski, Aya Mahfouz, Julia Lawall, Sudip Mukherjee,
	linux-kernel
  Cc: Shraddha Barke

This patch replaces memcpy with eth_addr_copy

The changes were applied using the following coccinelle
rule:
@@ expression e1, e2; @@
- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 6f6fe38..577d3a4 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -3430,7 +3430,7 @@ static int r8192_set_mac_adr(struct net_device *dev, void *mac)
 
 	down(&priv->wx_sem);
 
-	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
+	ether_addr_copy(dev->dev_addr, addr->sa_data);
 
 	schedule_work(&priv->reset_wq);
 	up(&priv->wx_sem);
-- 
2.1.4


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

* Re: [PATCH 1/3] Staging: rtl8712: Replace memcpy by ether_addr_copy
  2015-09-06 19:04 [PATCH 1/3] Staging: rtl8712: Replace memcpy by ether_addr_copy Shraddha Barke
  2015-09-06 19:04 ` [PATCH 2/3] Staging: rtl8192e: Replace memcpy by ethr_addr_copy Shraddha Barke
  2015-09-06 19:04 ` [PATCH 3/3] Staging: rtl8192u: r8192U_core.c: Replace memcpy with eth_addr_copy Shraddha Barke
@ 2015-09-06 19:37 ` Larry Finger
  2 siblings, 0 replies; 6+ messages in thread
From: Larry Finger @ 2015-09-06 19:37 UTC (permalink / raw)
  To: Shraddha Barke, Greg Kroah-Hartman, Florian Schilhabel,
	Mateusz Kulikowski, Aya Mahfouz, Julia Lawall, Sudip Mukherjee,
	linux-kernel

On 09/06/2015 02:04 PM, Shraddha Barke wrote:
> This patch replaces memcpy by ethr_addr_copy
>
> The change was made using Coccinelle
>
> @@ expression e1, e2; @@
> - memcpy(e1, e2, ETH_ALEN);
> + ether_addr_copy(e1, e2);
>
> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
> ---
>   drivers/staging/rtl8712/rtl871x_mp_ioctl.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Your commit message has a typo.

More seriously, ether_addr_copy() requires that both arguments be u16 aligned. 
This condition is not hard to meet, but I see no indication in your commit 
message that you have checked this requirement. As a result, I must NACK this patch.

Coccinelle is a wonderful tool, but the user must exercise judgment when 
applying the results.

Larry

Larry

>
> diff --git a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c
> index 77f01bf..76c1cfe 100644
> --- a/drivers/staging/rtl8712/rtl871x_mp_ioctl.c
> +++ b/drivers/staging/rtl8712/rtl871x_mp_ioctl.c
> @@ -167,7 +167,7 @@ static int mp_start_test(struct _adapter *padapter)
>   	int res = _SUCCESS;
>
>   	/* 3 1. initialize a new struct wlan_bssid_ex */
> -	memcpy(bssid.MacAddress, pmppriv->network_macaddr, ETH_ALEN);
> +	ether_addr_copy(bssid.MacAddress, pmppriv->network_macaddr);
>   	bssid.Ssid.SsidLength = 16;
>   	memcpy(bssid.Ssid.Ssid, (unsigned char *)"mp_pseudo_adhoc",
>   		bssid.Ssid.SsidLength);
>


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

* Re: [PATCH 2/3] Staging: rtl8192e: Replace memcpy by ethr_addr_copy
  2015-09-06 19:04 ` [PATCH 2/3] Staging: rtl8192e: Replace memcpy by ethr_addr_copy Shraddha Barke
@ 2015-09-06 19:38   ` Larry Finger
  0 siblings, 0 replies; 6+ messages in thread
From: Larry Finger @ 2015-09-06 19:38 UTC (permalink / raw)
  To: Shraddha Barke, Greg Kroah-Hartman, Florian Schilhabel,
	Mateusz Kulikowski, Aya Mahfouz, Julia Lawall, Sudip Mukherjee,
	linux-kernel

On 09/06/2015 02:04 PM, Shraddha Barke wrote:
> The patch replaces memcpy with ethr_addr_copy
>
> The changes were applied using the following coccinelle
> rule:
> @@ expression e1, e2; @@
> - memcpy(e1, e2, ETH_ALEN);
> + ether_addr_copy(e1, e2);
>
> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
> ---
>   drivers/staging/rtl8192e/rtllib_softmac_wx.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

The same comments apply as in patch 1/3. NACK.

Larry

>
> diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
> index 86f52ac..cf243fe 100644
> --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c
> +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c
> @@ -122,8 +122,8 @@ int rtllib_wx_get_wap(struct rtllib_device *ieee,
>
>   		eth_zero_addr(wrqu->ap_addr.sa_data);
>   	else
> -		memcpy(wrqu->ap_addr.sa_data,
> -		       ieee->current_network.bssid, ETH_ALEN);
> +		ether_addr_copy(wrqu->ap_addr.sa_data,
> +				ieee->current_network.bssid);
>
>   	spin_unlock_irqrestore(&ieee->lock, flags);
>
>


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

* Re: [PATCH 3/3] Staging: rtl8192u: r8192U_core.c: Replace memcpy with eth_addr_copy
  2015-09-06 19:04 ` [PATCH 3/3] Staging: rtl8192u: r8192U_core.c: Replace memcpy with eth_addr_copy Shraddha Barke
@ 2015-09-06 19:39   ` Larry Finger
  0 siblings, 0 replies; 6+ messages in thread
From: Larry Finger @ 2015-09-06 19:39 UTC (permalink / raw)
  To: Shraddha Barke, Greg Kroah-Hartman, Florian Schilhabel,
	Mateusz Kulikowski, Aya Mahfouz, Julia Lawall, Sudip Mukherjee,
	linux-kernel

On 09/06/2015 02:04 PM, Shraddha Barke wrote:
> This patch replaces memcpy with eth_addr_copy
>
> The changes were applied using the following coccinelle
> rule:
> @@ expression e1, e2; @@
> - memcpy(e1, e2, ETH_ALEN);
> + ether_addr_copy(e1, e2);
>
> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
> ---
>   drivers/staging/rtl8192u/r8192U_core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index 6f6fe38..577d3a4 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -3430,7 +3430,7 @@ static int r8192_set_mac_adr(struct net_device *dev, void *mac)
>
>   	down(&priv->wx_sem);
>
> -	memcpy(dev->dev_addr, addr->sa_data, ETH_ALEN);
> +	ether_addr_copy(dev->dev_addr, addr->sa_data);
>
>   	schedule_work(&priv->reset_wq);
>   	up(&priv->wx_sem);
>

This patch has the same problems as do both patches 1 and 2.

NACK.

Larry


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

end of thread, other threads:[~2015-09-06 19:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-06 19:04 [PATCH 1/3] Staging: rtl8712: Replace memcpy by ether_addr_copy Shraddha Barke
2015-09-06 19:04 ` [PATCH 2/3] Staging: rtl8192e: Replace memcpy by ethr_addr_copy Shraddha Barke
2015-09-06 19:38   ` Larry Finger
2015-09-06 19:04 ` [PATCH 3/3] Staging: rtl8192u: r8192U_core.c: Replace memcpy with eth_addr_copy Shraddha Barke
2015-09-06 19:39   ` Larry Finger
2015-09-06 19:37 ` [PATCH 1/3] Staging: rtl8712: Replace memcpy by ether_addr_copy Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox