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:
Muhammad Falak R Wani 2016-05-19 19:22:49 +05:30 committed by David S. Miller
parent e27f4a942a
commit 7c542772cc
1 changed files with 1 additions and 3 deletions

View File

@ -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 */