Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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 */