aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Kerr <[email protected]>2020-05-19 09:05:58 +0800
committerDavid S. Miller <[email protected]>2020-05-19 12:03:37 -0700
commitef01cee2ee1b369c57a936166483d40942bcc3e3 (patch)
tree1353e6ff7c37c9191a6d0d8bf6cab56e77e0a9f2
parentb15e62631c5f19fea9895f7632dae9c1b27fe0cd (diff)
net: bmac: Fix read of MAC address from ROM
In bmac_get_station_address, We're reading two bytes at a time from ROM, but we do that six times, resulting in 12 bytes of read & writes. This means we will write off the end of the six-byte destination buffer. This change fixes the for-loop to only read/write six bytes. Based on a proposed fix from Finn Thain <[email protected]>. Signed-off-by: Jeremy Kerr <[email protected]> Reported-by: Stan Johnson <[email protected]> Tested-by: Stan Johnson <[email protected]> Reported-by: Finn Thain <[email protected]> Signed-off-by: David S. Miller <[email protected]>
-rw-r--r--drivers/net/ethernet/apple/bmac.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c
index a58185b1d8bf..3e3711b60d01 100644
--- a/drivers/net/ethernet/apple/bmac.c
+++ b/drivers/net/ethernet/apple/bmac.c
@@ -1182,7 +1182,7 @@ bmac_get_station_address(struct net_device *dev, unsigned char *ea)
int i;
unsigned short data;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < 3; i++)
{
reset_and_select_srom(dev);
data = read_srom(dev, i + EnetAddressOffset/2, SROMAddressBits);