Commit bd091410 authored by Pascal Terjan's avatar Pascal Terjan Committed by David S. Miller

hysdn: fix writing outside the field on 64 bits

ifa_local is assumed to be unsigned long which lead to writing the address
at dev->dev_addr-2 instead of +2

noticed thanks to gcc:

drivers/isdn/hysdn/hysdn_net.c: In function `net_open':
drivers/isdn/hysdn/hysdn_net.c:91: warning: array subscript is below array bounds
Signed-off-by: default avatarPascal Terjan <pterjan@mandriva.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1c594c05
...@@ -83,12 +83,12 @@ net_open(struct net_device *dev) ...@@ -83,12 +83,12 @@ net_open(struct net_device *dev)
/* Fill in the MAC-level header (if not already set) */ /* Fill in the MAC-level header (if not already set) */
if (!card->mac_addr[0]) { if (!card->mac_addr[0]) {
for (i = 0; i < ETH_ALEN - sizeof(unsigned long); i++) for (i = 0; i < ETH_ALEN; i++)
dev->dev_addr[i] = 0xfc; dev->dev_addr[i] = 0xfc;
if ((in_dev = dev->ip_ptr) != NULL) { if ((in_dev = dev->ip_ptr) != NULL) {
struct in_ifaddr *ifa = in_dev->ifa_list; struct in_ifaddr *ifa = in_dev->ifa_list;
if (ifa != NULL) if (ifa != NULL)
memcpy(dev->dev_addr + (ETH_ALEN - sizeof(unsigned long)), &ifa->ifa_local, sizeof(unsigned long)); memcpy(dev->dev_addr + (ETH_ALEN - sizeof(ifa->ifa_local)), &ifa->ifa_local, sizeof(ifa->ifa_local));
} }
} else } else
memcpy(dev->dev_addr, card->mac_addr, ETH_ALEN); memcpy(dev->dev_addr, card->mac_addr, ETH_ALEN);
......
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