[TG3]: Fix bug in tg3_set_eeprom()
authorMichael Chan <mchan@broadcom.com>
Fri, 22 Apr 2005 00:12:46 +0000 (17:12 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 22 Apr 2005 00:12:46 +0000 (17:12 -0700)
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 <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tg3.c

index 30154642573644f8c49ca0c39ff7c294f9ec806a..fb3eb6f8a737db1c1e4d5b3f369dcf0b51433803 100644 (file)
@@ -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;