Commit 7c542772 authored by Muhammad Falak R Wani's avatar Muhammad Falak R Wani Committed by David S. Miller

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: default avatarMuhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e27f4a94
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment