firewire: don't write directly to netdev->dev_addr
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 firewire: don't write directly to netdev->dev_addr
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount of VLANs...") introduced a rbtree for faster Ethernet address look up. To maintain netdev->dev_addr in this tree we need to make all the writes to it go through appropriate helpers.
Prepare fwnet_hwaddr on the stack and use dev_addr_set() to copy it to netdev->dev_addr. We no longer need to worry about alignment. union fwnet_hwaddr does not have any padding and we set all fields so we don't need to zero it upfront.
--- drivers/firewire/net.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/firewire/net.c +7 -7
@@ -1443,8 +1443,8 @@ static int fwnet_probe(struct fw_unit *unit,struct net_device *net;bool allocated_netdev = false;struct fwnet_device *dev; +union fwnet_hwaddr ha;int ret; -union fwnet_hwaddr *ha;mutex_lock (&fwnet_device_mutex);
@@ -1491,12 +1491,12 @@ static int fwnet_probe(struct fw_unit *unit, net->max_mtu =4096U ;/* Set our hardware address while we're at it */ - ha = (union fwnet_hwaddr *)net->dev_addr; -put_unaligned_be64 (card->guid, &ha->uc.uniq_id); - ha->uc.max_rec = dev->card->max_receive; - ha->uc.sspd = dev->card->link_speed; -put_unaligned_be16 (dev->local_fifo >>32 , &ha->uc.fifo_hi); -put_unaligned_be32 (dev->local_fifo &0xffffffff , &ha->uc.fifo_lo); + ha.uc.uniq_id =cpu_to_be64 (card->guid); + ha.uc.max_rec = dev->card->max_receive; + ha.uc.sspd = dev->card->link_speed; + ha.uc.fifo_hi =cpu_to_be16 (dev->local_fifo >>32 ); + ha.uc.fifo_lo =cpu_to_be32 (dev->local_fifo &0xffffffff ); +dev_addr_set (net, ha.u);memset (net->broadcast,-1 , net->addr_len);
Signature · 1 line
2.31.1
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 11 lines · On Tue, 26 Oct 2021 10:53:52 -0700 you wrote:
Commit
406f42fa0d3c("net-next: When a bond have a massive amount of VLANs...") introduced a rbtree for faster Ethernet address look up. To maintainnetdev->dev_addrin this tree we need to make all the writes to it go through appropriate helpers.Prepare
fwnet_hwaddron the stack and usedev_addr_set()to copy it tonetdev->dev_addr. We no longer need to worry about alignment. unionfwnet_hwaddrdoes not have any padding and we set all fields so we don't need to zero it upfront.[...]
Here is the summary with links:
- [net-next] firewire: don't write directly to netdev->dev_addr
https://git.kernel.org/netdev/net-next/c/aaaaa1377e7a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html