aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tg3.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2005-04-21 20:12:46 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-04-21 20:12:46 -0400
commit1c8594b48b00a98d12477355e944e165a5f64cd5 (patch)
treef784f244a3322b25abb7fae02cae7be20a64eb53 /drivers/net/tg3.c
parente6af301be3c129adbc8a7c8ffb76e62533ad9575 (diff)
[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 <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r--drivers/net/tg3.c4
1 files changed, 3 insertions, 1 deletions
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,
6560 start = cpu_to_le32(start); 6560 start = cpu_to_le32(start);
6561 len += b_offset; 6561 len += b_offset;
6562 offset &= ~3; 6562 offset &= ~3;
6563 if (len < 4)
6564 len = 4;
6563 } 6565 }
6564 6566
6565 odd_len = 0; 6567 odd_len = 0;
6566 if ((len & 3) && ((len > 4) || (b_offset == 0))) { 6568 if (len & 3) {
6567 /* adjustments to end on required 4 byte boundary */ 6569 /* adjustments to end on required 4 byte boundary */
6568 odd_len = 1; 6570 odd_len = 1;
6569 len = (len + 3) & ~3; 6571 len = (len + 3) & ~3;