Subject: [PATCH 2.6.12-rc2 9/11] tg3: Fix bug in tg3_set_eeprom()

From: "Michael Chan" <[email-masked]>
Date: Mon, 18 Apr 2005 00:57:27 -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 <[email-masked]>
diff -Nru 108/drivers/net/tg3.c 109/drivers/net/tg3.c
--- 108/drivers/net/tg3.c	2005-04-15 17:48:23.000000000 -0700
+++ 109/drivers/net/tg3.c	2005-04-15 21:26:02.000000000 -0700
@@ -6560,10 +6560,12 @@
 		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;