Skip to contentSkip to conversation

: Fix bug in bnx2_nvram_write().

PATCH Applied Michael Chan 2 participants 2 messages Dec 14, 2006 – Dec 15, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 : Fix bug in bnx2_nvram_write().

[BNX2]: Fix bug in bnx2_nvram_write().

Length was not calculated correctly if the NVRAM offset is on a non- aligned offset.

drivers/net/bnx2.c +2 -2
index f296c37..4fa7cef 100644
@@ -3096,7 +3096,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 of
 
 	if ((align_start = (offset32 & 3))) {
 		offset32 &= ~3;
-		len32 += align_start;
+		len32 += (4 - align_start);
 		if ((rc = bnx2_nvram_read(bp, offset32, start, 4)))
 			return rc;
 	}
@@ -3114,7 +3114,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 of
 
 	if (align_start || align_end) {
 		buf = kmalloc(len32, GFP_KERNEL);
-		if (buf == 0)
+		if (buf == NULL)
 			return -ENOMEM;
 		if (align_start) {
 			memcpy(buf, start, 4);