From 1c8594b48b00a98d12477355e944e165a5f64cd5 Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Thu, 21 Apr 2005 17:12:46 -0700 Subject: [TG3]: Fix bug in tg3_set_eeprom() Fix a bug in tg3_set_eeprom() when the length is less than 4 and the offset is not 4-byte aligned. Signed-off-by: Michael Chan Signed-off-by: David S. Miller --- drivers/net/tg3.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 301546425736..fb3eb6f8a737 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -6560,10 +6560,12 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, start = cpu_to_le32(start); len += b_offset; offset &= ~3; + if (len < 4) + len = 4; } odd_len = 0; - if ((len & 3) && ((len > 4) || (b_offset == 0))) { + if (len & 3) { /* adjustments to end on required 4 byte boundary */ odd_len = 1; len = (len + 3) & ~3; -- cgit v1.2.3