All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: rtl8712: Replace memcpy with ether_addr_copy
@ 2015-03-14 11:15 Vatika Harlalka
  2015-03-14 15:57 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Vatika Harlalka @ 2015-03-14 11:15 UTC (permalink / raw)
  To: outreachy-kernel

Replace
Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
Use ether_addr_copy instead of memcpy(a, b, ETH_ALEN)

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

diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c
index ebfb29e..e1b54fb 100644
--- a/drivers/staging/rtl8712/os_intfs.c
+++ b/drivers/staging/rtl8712/os_intfs.c
@@ -181,7 +181,7 @@ static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p)
 	struct sockaddr *addr = p;
 
 	if (padapter->bup == false)
-		memcpy(pnetdev->dev_addr, addr->sa_data, ETH_ALEN);
+		ether_addr_copy(pnetdev->dev_addr, addr->sa_data);
 	return 0;
 }
 
-- 
1.9.1



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

* Re: [Outreachy kernel] [PATCH] Staging: rtl8712: Replace memcpy with ether_addr_copy
  2015-03-14 11:15 [PATCH] Staging: rtl8712: Replace memcpy with ether_addr_copy Vatika Harlalka
@ 2015-03-14 15:57 ` Julia Lawall
  0 siblings, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2015-03-14 15:57 UTC (permalink / raw)
  To: Vatika Harlalka; +Cc: outreachy-kernel

On Sat, 14 Mar 2015, Vatika Harlalka wrote:

> Replace
> Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
> Use ether_addr_copy instead of memcpy(a, b, ETH_ALEN)

Something went wrong with the commit message.

Also eth_addr_copy requires alignment (Please note: dst & src must both
be aligned to u16).  You need to justify why this property holds.

julia

>
> ---
>  drivers/staging/rtl8712/os_intfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c
> index ebfb29e..e1b54fb 100644
> --- a/drivers/staging/rtl8712/os_intfs.c
> +++ b/drivers/staging/rtl8712/os_intfs.c
> @@ -181,7 +181,7 @@ static int r871x_net_set_mac_address(struct net_device *pnetdev, void *p)
>  	struct sockaddr *addr = p;
>
>  	if (padapter->bup == false)
> -		memcpy(pnetdev->dev_addr, addr->sa_data, ETH_ALEN);
> +		ether_addr_copy(pnetdev->dev_addr, addr->sa_data);
>  	return 0;
>  }
>
> --
> 1.9.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150314111518.GA12847%40akanksha.
> For more options, visit https://groups.google.com/d/optout.
>


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

* Re: [Outreachy kernel] [PATCH] Staging: rtl8712: replace memcpy with ether_addr_copy
  2015-03-14 13:17 [PATCH] Staging: rtl8712: replace " Haneen Mohammed
@ 2015-03-16 14:47 ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2015-03-16 14:47 UTC (permalink / raw)
  To: Haneen Mohammed; +Cc: outreachy-kernel

On Sat, Mar 14, 2015 at 04:17:04PM +0300, Haneen Mohammed wrote:
> This patch replace memcpy with ethe_addr_copy to address the following
> warning generated by checkpatch.pl: ""Prefer ether_addr_copy over memcpy
> if the Ethernet addresses are __aligned(2)"
> 
> Follwoing is the output of pahole for the relevant datastructures:
> 1- for  "iwe.u.ap_addr.sa_data" and "wrqu->ap_addr.sa_data"
> 
> struct sockaddr {
>         sa_family_t                sa_family;            /*     0     2
> */
>         char                       sa_data[14];          /*     2    14
> */

Your lines are wrapped here very oddly.  Please fix that up and resend.

thanks,

greg k-h


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-14 11:15 [PATCH] Staging: rtl8712: Replace memcpy with ether_addr_copy Vatika Harlalka
2015-03-14 15:57 ` [Outreachy kernel] " Julia Lawall
2015-03-14 13:17 [PATCH] Staging: rtl8712: replace " Haneen Mohammed
2015-03-16 14:47 ` [Outreachy kernel] " Greg KH

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.