aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Meyer <thomas@m3y3r.de>2013-06-01 11:40:02 +0200
committerMark Brown <broonie@linaro.org>2014-06-16 21:14:22 +0100
commit01bcc35baaa09d0dc8ac6f90dfe5b90e0efaa6f9 (patch)
treeecb4368688d9177e71e4948ddcf62c7edd993b23
parent8bb495e3f02401ee6f76d1b1d77f3ac9f079e376 (diff)
downloadlinux-linaro-stable-01bcc35baaa09d0dc8ac6f90dfe5b90e0efaa6f9.tar.gz
efi, pstore: Cocci spatch "memdup.spatch"
Change a kmalloc() + memcpy() pair for a single kmemdup() call. Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Tony Luck <tony.luck@intel.com> (cherry picked from commit 77418921649427577143667fcf00ccb8a809762a) Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--drivers/firmware/efi/efi-pstore.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/firmware/efi/efi-pstore.c b/drivers/firmware/efi/efi-pstore.c
index 202d2c85ba2e..c692bb662178 100644
--- a/drivers/firmware/efi/efi-pstore.c
+++ b/drivers/firmware/efi/efi-pstore.c
@@ -79,10 +79,9 @@ static int efi_pstore_read_func(struct efivar_entry *entry, void *data)
&entry->var.DataSize, entry->var.Data);
size = entry->var.DataSize;
- *cb_data->buf = kmalloc(size, GFP_KERNEL);
+ *cb_data->buf = kmemdup(entry->var.Data, size, GFP_KERNEL);
if (*cb_data->buf == NULL)
return -ENOMEM;
- memcpy(*cb_data->buf, entry->var.Data, size);
return size;
}