netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3][BNX2]: Fix bug in bnx2_nvram_write().
@ 2006-12-14  2:30 Michael Chan
  2006-12-14 23:57 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Chan @ 2006-12-14  2:30 UTC (permalink / raw)
  To: davem, agospoda, netdev

[BNX2]: Fix bug in bnx2_nvram_write().

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

Signed-off-by: Michael Chan <mchan@broadcom.com>

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index f296c37..4fa7cef 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -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);



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-12-15  0:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-14  2:30 [PATCH 2/3][BNX2]: Fix bug in bnx2_nvram_write() Michael Chan
2006-12-14 23:57 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).