summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmitoj Kaur Chawla <amitoj1606@gmail.com>2016-02-16 00:55:25 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-20 14:54:05 -0800
commit94b397cd253396c601d871f250cd93362618bdf6 (patch)
treeff22e413f6dc1f313308973c315656a71aa3ed52
parent1e613801ce8771b3e82e68bab0247ef3ce5d8a3f (diff)
staging: rdma: hfi1: Replace kmalloc and memcpy with kmemdup
Replace kmalloc and memcpy with kmemdup. Found using Coccinelle. The semantic patch used to make this change can be found here: scripts/coccinelle/api/memdup.cocci Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 e569f9f456c5..47dfe2584760 100644
--- a/drivers/staging/rdma/hfi1/efivar.c
+++ b/drivers/staging/rdma/hfi1/efivar.c
@@ -127,13 +127,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;