[PATCH] : Fix bug in tg3_set_eeprom()

Linux Kernel Mailing List <[email protected]> Tue, 24 May 2005 12:44:05 +0000
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1545, 2005/05/24 09:44:05-03:00, [email protected]

	[PATCH] : Fix bug in tg3_set_eeprom()
	
	[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 <[email protected]>
	Signed-off-by: David S. Miller <[email protected]>



 tg3.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


diff -Nru a/drivers/net/tg3.c b/drivers/net/tg3.c
--- a/drivers/net/tg3.c	2005-05-24 14:06:10 -07:00
+++ b/drivers/net/tg3.c	2005-05-24 14:06:10 -07:00
@@ -6529,10 +6529,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;