diff options
| author | Daniel Drake <dsd@laptop.org> | 2009-12-24 03:11:24 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2009-12-26 23:24:45 -0500 |
| commit | 1f04493123763f5b8bc6d5de9aed0222345c052c (patch) | |
| tree | 85b27e8a82a63a875740b67e9016fc11f432c453 | |
| parent | f74dac0859bd9678b289ad9dc215026fd7ce033e (diff) | |
Fix MAC address access in 3c507, ibmlana, pcnet32 and libertas
Commit f001fde5eadd915f4858d22ed70d7040f48767cf changed
net_device.dev_addr from a 32-byte array to a pointer.
I found 4 ethernet drivers which rely on sizeof(dev_addr), which are now
only copying 4 bytes of the address information on 32bit systems.
Fix them to use ETH_ALEN.
Signed-off-by: Daniel Drake <dsd@laptop.org>
Reviewed-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/3c507.c | 4 | ||||
| -rw-r--r-- | drivers/net/ibmlana.c | 3 | ||||
| -rw-r--r-- | drivers/net/pcnet32.c | 3 | ||||
| -rw-r--r-- | drivers/net/wireless/libertas/mesh.c | 4 |
4 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c index fbc231153e55..77cf0901a441 100644 --- a/drivers/net/3c507.c +++ b/drivers/net/3c507.c | |||
| @@ -56,6 +56,7 @@ static const char version[] = | |||
| 56 | #include <linux/errno.h> | 56 | #include <linux/errno.h> |
| 57 | #include <linux/netdevice.h> | 57 | #include <linux/netdevice.h> |
| 58 | #include <linux/etherdevice.h> | 58 | #include <linux/etherdevice.h> |
| 59 | #include <linux/if_ether.h> | ||
| 59 | #include <linux/skbuff.h> | 60 | #include <linux/skbuff.h> |
| 60 | #include <linux/slab.h> | 61 | #include <linux/slab.h> |
| 61 | #include <linux/init.h> | 62 | #include <linux/init.h> |
| @@ -734,8 +735,7 @@ static void init_82586_mem(struct net_device *dev) | |||
| 734 | memcpy_toio(lp->base, init_words + 5, sizeof(init_words) - 10); | 735 | memcpy_toio(lp->base, init_words + 5, sizeof(init_words) - 10); |
| 735 | 736 | ||
| 736 | /* Fill in the station address. */ | 737 | /* Fill in the station address. */ |
| 737 | memcpy_toio(lp->base+SA_OFFSET, dev->dev_addr, | 738 | memcpy_toio(lp->base+SA_OFFSET, dev->dev_addr, ETH_ALEN); |
| 738 | sizeof(dev->dev_addr)); | ||
| 739 | 739 | ||
| 740 | /* The Tx-block list is written as needed. We just set up the values. */ | 740 | /* The Tx-block list is written as needed. We just set up the values. */ |
| 741 | lp->tx_cmd_link = IDLELOOP + 4; | 741 | lp->tx_cmd_link = IDLELOOP + 4; |
diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c index 090a6d3af112..052c74091d91 100644 --- a/drivers/net/ibmlana.c +++ b/drivers/net/ibmlana.c | |||
| @@ -87,6 +87,7 @@ History: | |||
| 87 | #include <linux/module.h> | 87 | #include <linux/module.h> |
| 88 | #include <linux/netdevice.h> | 88 | #include <linux/netdevice.h> |
| 89 | #include <linux/etherdevice.h> | 89 | #include <linux/etherdevice.h> |
| 90 | #include <linux/if_ether.h> | ||
| 90 | #include <linux/skbuff.h> | 91 | #include <linux/skbuff.h> |
| 91 | #include <linux/bitops.h> | 92 | #include <linux/bitops.h> |
| 92 | 93 | ||
| @@ -988,7 +989,7 @@ static int __devinit ibmlana_init_one(struct device *kdev) | |||
| 988 | 989 | ||
| 989 | /* copy out MAC address */ | 990 | /* copy out MAC address */ |
| 990 | 991 | ||
| 991 | for (z = 0; z < sizeof(dev->dev_addr); z++) | 992 | for (z = 0; z < ETH_ALEN; z++) |
| 992 | dev->dev_addr[z] = inb(dev->base_addr + MACADDRPROM + z); | 993 | dev->dev_addr[z] = inb(dev->base_addr + MACADDRPROM + z); |
| 993 | 994 | ||
| 994 | /* print config */ | 995 | /* print config */ |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index dcc67a35e8f2..e154677ff706 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
| @@ -45,6 +45,7 @@ static const char *const version = | |||
| 45 | #include <linux/crc32.h> | 45 | #include <linux/crc32.h> |
| 46 | #include <linux/netdevice.h> | 46 | #include <linux/netdevice.h> |
| 47 | #include <linux/etherdevice.h> | 47 | #include <linux/etherdevice.h> |
| 48 | #include <linux/if_ether.h> | ||
| 48 | #include <linux/skbuff.h> | 49 | #include <linux/skbuff.h> |
| 49 | #include <linux/spinlock.h> | 50 | #include <linux/spinlock.h> |
| 50 | #include <linux/moduleparam.h> | 51 | #include <linux/moduleparam.h> |
| @@ -1765,7 +1766,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
| 1765 | 1766 | ||
| 1766 | /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */ | 1767 | /* if the ethernet address is not valid, force to 00:00:00:00:00:00 */ |
| 1767 | if (!is_valid_ether_addr(dev->perm_addr)) | 1768 | if (!is_valid_ether_addr(dev->perm_addr)) |
| 1768 | memset(dev->dev_addr, 0, sizeof(dev->dev_addr)); | 1769 | memset(dev->dev_addr, 0, ETH_ALEN); |
| 1769 | 1770 | ||
| 1770 | if (pcnet32_debug & NETIF_MSG_PROBE) { | 1771 | if (pcnet32_debug & NETIF_MSG_PROBE) { |
| 1771 | printk(" %pM", dev->dev_addr); | 1772 | printk(" %pM", dev->dev_addr); |
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c index 2f91c9b808af..92b7a357a5e4 100644 --- a/drivers/net/wireless/libertas/mesh.c +++ b/drivers/net/wireless/libertas/mesh.c | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #include <linux/delay.h> | 2 | #include <linux/delay.h> |
| 3 | #include <linux/etherdevice.h> | 3 | #include <linux/etherdevice.h> |
| 4 | #include <linux/netdevice.h> | 4 | #include <linux/netdevice.h> |
| 5 | #include <linux/if_ether.h> | ||
| 5 | #include <linux/if_arp.h> | 6 | #include <linux/if_arp.h> |
| 6 | #include <linux/kthread.h> | 7 | #include <linux/kthread.h> |
| 7 | #include <linux/kfifo.h> | 8 | #include <linux/kfifo.h> |
| @@ -351,8 +352,7 @@ int lbs_add_mesh(struct lbs_private *priv) | |||
| 351 | 352 | ||
| 352 | mesh_dev->netdev_ops = &mesh_netdev_ops; | 353 | mesh_dev->netdev_ops = &mesh_netdev_ops; |
| 353 | mesh_dev->ethtool_ops = &lbs_ethtool_ops; | 354 | mesh_dev->ethtool_ops = &lbs_ethtool_ops; |
| 354 | memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, | 355 | memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, ETH_ALEN); |
| 355 | sizeof(priv->dev->dev_addr)); | ||
| 356 | 356 | ||
| 357 | SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); | 357 | SET_NETDEV_DEV(priv->mesh_dev, priv->dev->dev.parent); |
| 358 | 358 | ||
