From 2b8b34a948d063c4e803105ec0a3e8d27bd97c19 Mon Sep 17 00:00:00 2001 From: Harish Chegondi Date: Sat, 5 Mar 2016 08:49:34 -0800 Subject: [PATCH] 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 Reviewed-by: Mike Marciniszyn Reviewed-by: Dennis Dalessandro Signed-off-by: Harish Chegondi Signed-off-by: Doug Ledford --- drivers/staging/rdma/hfi1/efivar.c | 3 +-- 1 file changed, 1 insertion(+), 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; -- GitLab