All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ethernet: s2io: fix setting mac address during resume
@ 2021-10-13 14:35 Arnd Bergmann
  2021-10-14 14:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2021-10-13 14:35 UTC (permalink / raw)
  To: Jon Mason, David S. Miller, Jakub Kicinski, Sreenivasa Honnur,
	Jeff Garzik
  Cc: Arnd Bergmann, Jason Gunthorpe, netdev, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

After recent cleanups, gcc started warning about a suspicious
memcpy() call during the s2io_io_resume() function:

In function '__dev_addr_set',
    inlined from 'eth_hw_addr_set' at include/linux/etherdevice.h:318:2,
    inlined from 's2io_set_mac_addr' at drivers/net/ethernet/neterion/s2io.c:5205:2,
    inlined from 's2io_io_resume' at drivers/net/ethernet/neterion/s2io.c:8569:7:
arch/x86/include/asm/string_32.h:182:25: error: '__builtin_memcpy' accessing 6 bytes at offsets 0 and 2 overlaps 4 bytes at offset 2 [-Werror=restrict]
  182 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/netdevice.h:4648:9: note: in expansion of macro 'memcpy'
 4648 |         memcpy(dev->dev_addr, addr, len);
      |         ^~~~~~

What apparently happened is that an old cleanup changed the calling
conventions for s2io_set_mac_addr() from taking an ethernet address
as a character array to taking a struct sockaddr, but one of the
callers was not changed at the same time.

Change it to instead call the low-level do_s2io_prog_unicast() function
that still takes the old argument type.

Fixes: 2fd376884558 ("S2io: Added support set_mac_address driver entry point")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/neterion/s2io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c
index 5454c1c2f8ad..ade47c4fdae0 100644
--- a/drivers/net/ethernet/neterion/s2io.c
+++ b/drivers/net/ethernet/neterion/s2io.c
@@ -8566,7 +8566,7 @@ static void s2io_io_resume(struct pci_dev *pdev)
 			return;
 		}
 
-		if (s2io_set_mac_addr(netdev, netdev->dev_addr) == FAILURE) {
+		if (do_s2io_prog_unicast(netdev, netdev->dev_addr) == FAILURE) {
 			s2io_card_down(sp);
 			pr_err("Can't restore mac addr after reset.\n");
 			return;
-- 
2.29.2


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

* Re: [PATCH] ethernet: s2io: fix setting mac address during resume
  2021-10-13 14:35 [PATCH] ethernet: s2io: fix setting mac address during resume Arnd Bergmann
@ 2021-10-14 14:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-14 14:20 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: jdmason, davem, kuba, sreenivasa.honnur, jeff, arnd, jgg, netdev,
	linux-kernel

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 13 Oct 2021 16:35:49 +0200 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> After recent cleanups, gcc started warning about a suspicious
> memcpy() call during the s2io_io_resume() function:
> 
> In function '__dev_addr_set',
>     inlined from 'eth_hw_addr_set' at include/linux/etherdevice.h:318:2,
>     inlined from 's2io_set_mac_addr' at drivers/net/ethernet/neterion/s2io.c:5205:2,
>     inlined from 's2io_io_resume' at drivers/net/ethernet/neterion/s2io.c:8569:7:
> arch/x86/include/asm/string_32.h:182:25: error: '__builtin_memcpy' accessing 6 bytes at offsets 0 and 2 overlaps 4 bytes at offset 2 [-Werror=restrict]
>   182 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
>       |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/netdevice.h:4648:9: note: in expansion of macro 'memcpy'
>  4648 |         memcpy(dev->dev_addr, addr, len);
>       |         ^~~~~~
> 
> [...]

Here is the summary with links:
  - ethernet: s2io: fix setting mac address during resume
    https://git.kernel.org/netdev/net/c/40507e7aada8

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-10-14 14:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 14:35 [PATCH] ethernet: s2io: fix setting mac address during resume Arnd Bergmann
2021-10-14 14:20 ` patchwork-bot+netdevbpf

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.