Commit 007c9512 authored by Jakub Kicinski's avatar Jakub Kicinski Committed by David S. Miller

ethernet: 3com/typhoon: don't write directly to netdev->dev_addr

This driver casts off the const and writes directly to netdev->dev_addr.
This will result in a MAC address tree corruption and a warning.

Compile tested ppc6xx_defconfig.

Fixes: adeef3e3 ("net: constify netdev->dev_addr")
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 429c3be8
...@@ -2278,6 +2278,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2278,6 +2278,7 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
struct net_device *dev; struct net_device *dev;
struct typhoon *tp; struct typhoon *tp;
int card_id = (int) ent->driver_data; int card_id = (int) ent->driver_data;
u8 addr[ETH_ALEN] __aligned(4);
void __iomem *ioaddr; void __iomem *ioaddr;
void *shared; void *shared;
dma_addr_t shared_dma; dma_addr_t shared_dma;
...@@ -2409,8 +2410,9 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -2409,8 +2410,9 @@ typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
goto error_out_reset; goto error_out_reset;
} }
*(__be16 *)&dev->dev_addr[0] = htons(le16_to_cpu(xp_resp[0].parm1)); *(__be16 *)&addr[0] = htons(le16_to_cpu(xp_resp[0].parm1));
*(__be32 *)&dev->dev_addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2)); *(__be32 *)&addr[2] = htonl(le32_to_cpu(xp_resp[0].parm2));
eth_hw_addr_set(dev, addr);
if (!is_valid_ether_addr(dev->dev_addr)) { if (!is_valid_ether_addr(dev->dev_addr)) {
err_msg = "Could not obtain valid ethernet address, aborting"; err_msg = "Could not obtain valid ethernet address, aborting";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment