* [PATCH] staging: rtl8712: Use ether_addr_copy() instead of memcpy()
@ 2015-05-17 20:57 Jagan Teki
2015-05-17 23:27 ` Greg Kroah-Hartman
2015-05-18 0:09 ` Larry Finger
0 siblings, 2 replies; 3+ messages in thread
From: Jagan Teki @ 2015-05-17 20:57 UTC (permalink / raw)
To: linux-kernel
Cc: devel, Jagan Teki, Greg Kroah-Hartman, Larry Finger, Florian Schilhabel
This patch fixes to use ether_addr_copy() instead of memcpy()
Encounter this by applying checkpatch.pl against this file:
WARNING: Prefer ether_addr_copy() over memcpy()
if the Ethernet addresses are __aligned(2)
Signed-off-by: Jagan Teki <jteki@openedev.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
---
drivers/staging/rtl8712/os_intfs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c
index 6e776e5..0d27df6 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;
}
@@ -395,8 +395,8 @@ static int netdev_open(struct net_device *pnetdev)
goto netdev_open_error;
if (r8712_initmac == NULL)
/* Use the mac address stored in the Efuse */
- memcpy(pnetdev->dev_addr,
- padapter->eeprompriv.mac_addr, ETH_ALEN);
+ ether_addr_copy(pnetdev->dev_addr,
+ padapter->eeprompriv.mac_addr);
else {
/* We have to inform f/w to use user-supplied MAC
* address.
@@ -412,8 +412,8 @@ static int netdev_open(struct net_device *pnetdev)
* the eeprompriv.mac_addr should store the mac which
* users specify.
*/
- memcpy(padapter->eeprompriv.mac_addr,
- pnetdev->dev_addr, ETH_ALEN);
+ ether_addr_copy(padapter->eeprompriv.mac_addr,
+ pnetdev->dev_addr);
}
if (start_drv_threads(padapter) != _SUCCESS)
goto netdev_open_error;
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8712: Use ether_addr_copy() instead of memcpy()
2015-05-17 20:57 [PATCH] staging: rtl8712: Use ether_addr_copy() instead of memcpy() Jagan Teki
@ 2015-05-17 23:27 ` Greg Kroah-Hartman
2015-05-18 0:09 ` Larry Finger
1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2015-05-17 23:27 UTC (permalink / raw)
To: Jagan Teki; +Cc: linux-kernel, devel, Larry Finger, Florian Schilhabel
On Mon, May 18, 2015 at 02:27:01AM +0530, Jagan Teki wrote:
> This patch fixes to use ether_addr_copy() instead of memcpy()
>
> Encounter this by applying checkpatch.pl against this file:
> WARNING: Prefer ether_addr_copy() over memcpy()
> if the Ethernet addresses are __aligned(2)
>
> Signed-off-by: Jagan Teki <jteki@openedev.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
> ---
> drivers/staging/rtl8712/os_intfs.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
You need to prove that the addresses are aligned, please do so in the
changelog entry.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: rtl8712: Use ether_addr_copy() instead of memcpy()
2015-05-17 20:57 [PATCH] staging: rtl8712: Use ether_addr_copy() instead of memcpy() Jagan Teki
2015-05-17 23:27 ` Greg Kroah-Hartman
@ 2015-05-18 0:09 ` Larry Finger
1 sibling, 0 replies; 3+ messages in thread
From: Larry Finger @ 2015-05-18 0:09 UTC (permalink / raw)
To: Jagan Teki, linux-kernel; +Cc: devel, Greg Kroah-Hartman, Florian Schilhabel
On 05/17/2015 03:57 PM, Jagan Teki wrote:
> This patch fixes to use ether_addr_copy() instead of memcpy()
>
> Encounter this by applying checkpatch.pl against this file:
> WARNING: Prefer ether_addr_copy() over memcpy()
> if the Ethernet addresses are __aligned(2)
>
> Signed-off-by: Jagan Teki <jteki@openedev.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Larry Finger <Larry.Finger@lwfinger.net>
> Cc: Florian Schilhabel <florian.c.schilhabel@googlemail.com>
> ---
Can you assure us that you have carefully checked the the source address of
addr->sa_data and padapter->eeprompriv.mac_addr are suitably aligned? At a
minimum, have you tested this change on real hardware?
Larry
> drivers/staging/rtl8712/os_intfs.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c
> index 6e776e5..0d27df6 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;
> }
>
> @@ -395,8 +395,8 @@ static int netdev_open(struct net_device *pnetdev)
> goto netdev_open_error;
> if (r8712_initmac == NULL)
> /* Use the mac address stored in the Efuse */
> - memcpy(pnetdev->dev_addr,
> - padapter->eeprompriv.mac_addr, ETH_ALEN);
> + ether_addr_copy(pnetdev->dev_addr,
> + padapter->eeprompriv.mac_addr);
> else {
> /* We have to inform f/w to use user-supplied MAC
> * address.
> @@ -412,8 +412,8 @@ static int netdev_open(struct net_device *pnetdev)
> * the eeprompriv.mac_addr should store the mac which
> * users specify.
> */
> - memcpy(padapter->eeprompriv.mac_addr,
> - pnetdev->dev_addr, ETH_ALEN);
> + ether_addr_copy(padapter->eeprompriv.mac_addr,
> + pnetdev->dev_addr);
> }
> if (start_drv_threads(padapter) != _SUCCESS)
> goto netdev_open_error;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-05-18 0:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-17 20:57 [PATCH] staging: rtl8712: Use ether_addr_copy() instead of memcpy() Jagan Teki
2015-05-17 23:27 ` Greg Kroah-Hartman
2015-05-18 0:09 ` Larry Finger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome