提交 6a13add1 编写于 作者: M Michael Chan 提交者: David S. Miller

[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: NMichael Chan <mchan@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 faac9c4b
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册