diff options
author | Kristoffer Glembo <kristoffer@gaisler.com> | 2011-07-05 00:39:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-05 00:39:10 -0400 |
commit | 9b9cfe7cf663c16c0d93349cc0094bb28ae7135a (patch) | |
tree | 24b51f8b2e8c3f7324dbde57e2cc6c0dd28ebe66 | |
parent | c349a528cd47e2272ded0ea358363855e86180da (diff) |
greth: greth_set_mac_add would corrupt the MAC address.
The MAC address was set using the signed char sockaddr->sa_addr
field and thus the address could be corrupted through sign extension.
Signed-off-by: Kristoffer Glembo <kristoffer@gaisler.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/greth.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/greth.c b/drivers/net/greth.c index f181304a7ab6..672f096fe090 100644 --- a/drivers/net/greth.c +++ b/drivers/net/greth.c | |||
@@ -1015,11 +1015,10 @@ static int greth_set_mac_add(struct net_device *dev, void *p) | |||
1015 | return -EINVAL; | 1015 | return -EINVAL; |
1016 | 1016 | ||
1017 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); | 1017 | memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); |
1018 | GRETH_REGSAVE(regs->esa_msb, dev->dev_addr[0] << 8 | dev->dev_addr[1]); | ||
1019 | GRETH_REGSAVE(regs->esa_lsb, dev->dev_addr[2] << 24 | dev->dev_addr[3] << 16 | | ||
1020 | dev->dev_addr[4] << 8 | dev->dev_addr[5]); | ||
1018 | 1021 | ||
1019 | GRETH_REGSAVE(regs->esa_msb, addr->sa_data[0] << 8 | addr->sa_data[1]); | ||
1020 | GRETH_REGSAVE(regs->esa_lsb, | ||
1021 | addr->sa_data[2] << 24 | addr-> | ||
1022 | sa_data[3] << 16 | addr->sa_data[4] << 8 | addr->sa_data[5]); | ||
1023 | return 0; | 1022 | return 0; |
1024 | } | 1023 | } |
1025 | 1024 | ||