aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarish Chegondi2016-03-05 08:49:34 -0800
committerDoug Ledford2016-03-17 15:55:12 -0400
commit2b8b34a948d063c4e803105ec0a3e8d27bd97c19 (patch)
treea7b529ad0c9d8e3f88c087797e7b24d2374b573e
parentbf640096e670a35e3a7ba1336216664f89a2bcf1 (diff)
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: Jubin John <jubin.john@intel.com> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Harish Chegondi <harish.chegondi@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/staging/rdma/hfi1/efivar.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/rdma/hfi1/efivar.c b/drivers/staging/rdma/hfi1/efivar.c
index 5fe39241b635..3f014f96f9e0 100644
--- a/drivers/staging/rdma/hfi1/efivar.c
+++ b/drivers/staging/rdma/hfi1/efivar.c
@@ -125,13 +125,12 @@ static int read_efi_var(const char *name, unsigned long *size,
* temporary buffer. Now allocate a correctly sized
* buffer.
*/
- data = kmalloc(temp_size, GFP_KERNEL);
+ data = kmemdup(temp_buffer, temp_size, GFP_KERNEL);
if (!data) {
ret = -ENOMEM;
goto fail;
}
- memcpy(data, temp_buffer, temp_size);
*size = temp_size;
*return_data = data;