mirror of https://gitee.com/openkylin/linux.git
net:liquidio: use kmemdup
Use kmemdup when some other buffer is immediately copied into allocated region. It replaces call to allocation followed by memcpy, by a single call to kmemdup. Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e27f4a942a
commit
7c542772cc
|
@ -602,12 +602,10 @@ int octeon_download_firmware(struct octeon_device *oct, const u8 *data,
|
|||
snprintf(oct->fw_info.liquidio_firmware_version, 32, "LIQUIDIO: %s",
|
||||
h->version);
|
||||
|
||||
buffer = kmalloc(size, GFP_KERNEL);
|
||||
buffer = kmemdup(data, size, GFP_KERNEL);
|
||||
if (!buffer)
|
||||
return -ENOMEM;
|
||||
|
||||
memcpy(buffer, data, size);
|
||||
|
||||
p = buffer + sizeof(struct octeon_firmware_file_header);
|
||||
|
||||
/* load all images */
|
||||
|
|
Loading…
Reference in New Issue