From: Andrew Lunn <andrew@lunn•ch>
To: Jakub Kicinski <kuba@kernel•org>
Cc: davem@davemloft•net, netdev@vger•kernel.org
Subject: Re: [PATCH net-next 1/2] ethernet: use eth_hw_addr_set() for dev->addr_len cases
Date: Tue, 5 Oct 2021 00:18:45 +0200 [thread overview]
Message-ID: <YVt9xbVVoNb3p9ro@lunn.ch> (raw)
In-Reply-To: <20211004160522.1974052-1-kuba@kernel.org>
On Mon, Oct 04, 2021 at 09:05:21AM -0700, Jakub Kicinski wrote:
> Convert all Ethernet drivers from memcpy(... dev->addr_len)
> to eth_hw_addr_set():
>
> @@
> expression dev, np;
> @@
> - memcpy(dev->dev_addr, np, dev->addr_len)
> + eth_hw_addr_set(dev, np)
eth_hw_addr_set() uses ether_addr_copy(), which says:
Please note: dst & src must both be aligned to u16.
memcpy() does not have this restriction. If the source is something
funky, like an EEPROM, it could be oddly aligned.
If you are going to do this, i think the assumption needs removing, a
test added for unaligned addresses and fall back to memcpy().
Andrew
next prev parent reply other threads:[~2021-10-04 22:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-04 16:05 [PATCH net-next 1/2] ethernet: use eth_hw_addr_set() for dev->addr_len cases Jakub Kicinski
2021-10-04 16:05 ` [PATCH net-next 2/2] net: usb: " Jakub Kicinski
2021-10-04 22:18 ` Andrew Lunn [this message]
2021-10-04 22:56 ` [PATCH net-next 1/2] ethernet: " Jakub Kicinski
2021-10-05 12:30 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YVt9xbVVoNb3p9ro@lunn.ch \
--to=andrew@lunn$(echo .)ch \
--cc=davem@davemloft$(echo .)net \
--cc=kuba@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox