Skip to content

Commit

Permalink
[BNX2]: Fix bug in bnx2_nvram_write().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Chan authored and David S. Miller committed Dec 18, 2006
1 parent faac9c4 commit 6a13add
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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);
Expand Down

0 comments on commit 6a13add

Please sign in to comment.