net:liquidio: use kmemdup
Subsystems (3)
PATCH 1/1 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 <[email protected]>
--- drivers/net/ethernet/cavium/liquidio/octeon_device.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/cavium/liquidio/octeon_device.c +1 -3
@@ -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 */
Signature · 1 line
1.9.1
From: Muhammad Falak R Wani <[email protected]>
Date: Thu, 19 May 2016 19:22:49 +0530
Quoted 5 lines
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 <[email protected]>
Applied.