Commit 2b8b34a9 authored by Harish Chegondi's avatar Harish Chegondi Committed by Doug Ledford

IB/hfi1: Replace kmalloc and memcpy with a kmemdup

This change was recommended by Coccinelle tool when I ran the command:
-bash-4.2$ make coccicheck MODE=patch M=drivers/infiniband/hw/hfi1/
Reviewed-by: default avatarJubin John <jubin.john@intel.com>
Reviewed-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarHarish Chegondi <harish.chegondi@intel.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent bf640096
...@@ -125,13 +125,12 @@ static int read_efi_var(const char *name, unsigned long *size, ...@@ -125,13 +125,12 @@ static int read_efi_var(const char *name, unsigned long *size,
* temporary buffer. Now allocate a correctly sized * temporary buffer. Now allocate a correctly sized
* buffer. * buffer.
*/ */
data = kmalloc(temp_size, GFP_KERNEL); data = kmemdup(temp_buffer, temp_size, GFP_KERNEL);
if (!data) { if (!data) {
ret = -ENOMEM; ret = -ENOMEM;
goto fail; goto fail;
} }
memcpy(data, temp_buffer, temp_size);
*size = temp_size; *size = temp_size;
*return_data = data; *return_data = data;
......
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