Skip to content

Commit

Permalink
ksz884x: don't copy too much in netdev_set_mac_address()
Browse files Browse the repository at this point in the history
MAX_ADDR_LEN is 32.  ETH_ALEN is 6.  mac->sa_data is a 14 byte array, so
the memcpy() is doing a read past the end of the array.  I asked about
this on netdev and Ben Hutchings told me it's supposed to be copying
ETH_ALEN bytes (thanks Ben).

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Apr 19, 2012
1 parent 22b4a4f commit 716af4a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/micrel/ksz884x.c
Original file line number Diff line number Diff line change
Expand Up @@ -5675,7 +5675,7 @@ static int netdev_set_mac_address(struct net_device *dev, void *addr)
memcpy(hw->override_addr, mac->sa_data, ETH_ALEN);
}

memcpy(dev->dev_addr, mac->sa_data, MAX_ADDR_LEN);
memcpy(dev->dev_addr, mac->sa_data, ETH_ALEN);

interrupt = hw_block_intr(hw);

Expand Down

0 comments on commit 716af4a

Please sign in to comment.