]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[BNX2]: Fix bug in bnx2_nvram_write().
authorMichael Chan <mchan@broadcom.com>
Thu, 14 Dec 2006 23:56:50 +0000 (15:56 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 18 Dec 2006 05:59:16 +0000 (21:59 -0800)
Length was not calculated correctly if the NVRAM offset is on a non-
aligned offset.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bnx2.c

index f296c37f29b67a1894d2b98e7e59758aba073220..4fa7cefaa2965a52c6aa173dbbf23ba7c2d2345b 100644 (file)
@@ -3096,7 +3096,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
 
        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 offset, u8 *data_buf,
 
        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);