Skip to content

Commit

Permalink
qlcnic: Fix memory allocation
Browse files Browse the repository at this point in the history
o Use vzalloc() instead of kzalloc() for allocation of
  bootloader size memory. kzalloc() may fail to allocate
  the size of bootloader

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Manish Chopra authored and David S. Miller committed Dec 17, 2013
1 parent b17a44d commit 3fc38e2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1254,24 +1254,24 @@ static int qlcnic_83xx_copy_bootloader(struct qlcnic_adapter *adapter)
if (size & 0xF)
size = (size + 16) & ~0xF;

p_cache = kzalloc(size, GFP_KERNEL);
p_cache = vzalloc(size);
if (p_cache == NULL)
return -ENOMEM;

ret = qlcnic_83xx_lockless_flash_read32(adapter, src, p_cache,
size / sizeof(u32));
if (ret) {
kfree(p_cache);
vfree(p_cache);
return ret;
}
/* 16 byte write to MS memory */
ret = qlcnic_83xx_ms_mem_write128(adapter, dest, (u32 *)p_cache,
size / 16);
if (ret) {
kfree(p_cache);
vfree(p_cache);
return ret;
}
kfree(p_cache);
vfree(p_cache);

return ret;
}
Expand Down

0 comments on commit 3fc38e2

Please sign in to comment.