aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2006-12-14 18:56:50 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-18 00:59:16 -0500
commit6a13add1e1b802a29187a9af98a6ca26539dc33d (patch)
tree510c75c132064ec6a976ac0e70a61da02dd328ea
parentfaac9c4b753f420c02bdce0785d2657087830a12 (diff)
[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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bnx2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index f296c37f29b6..4fa7cefaa296 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -3096,7 +3096,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3096 3096
3097 if ((align_start = (offset32 & 3))) { 3097 if ((align_start = (offset32 & 3))) {
3098 offset32 &= ~3; 3098 offset32 &= ~3;
3099 len32 += align_start; 3099 len32 += (4 - align_start);
3100 if ((rc = bnx2_nvram_read(bp, offset32, start, 4))) 3100 if ((rc = bnx2_nvram_read(bp, offset32, start, 4)))
3101 return rc; 3101 return rc;
3102 } 3102 }
@@ -3114,7 +3114,7 @@ bnx2_nvram_write(struct bnx2 *bp, u32 offset, u8 *data_buf,
3114 3114
3115 if (align_start || align_end) { 3115 if (align_start || align_end) {
3116 buf = kmalloc(len32, GFP_KERNEL); 3116 buf = kmalloc(len32, GFP_KERNEL);
3117 if (buf == 0) 3117 if (buf == NULL)
3118 return -ENOMEM; 3118 return -ENOMEM;
3119 if (align_start) { 3119 if (align_start) {
3120 memcpy(buf, start, 4); 3120 memcpy(buf, start, 4);