diff options
author | Thomas Meyer <thomas@m3y3r.de> | 2013-06-01 05:40:02 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2013-06-03 18:37:02 -0400 |
commit | 77418921649427577143667fcf00ccb8a809762a (patch) | |
tree | 330bcc094a773d292e93f4b5b60ed9ced7cb1524 /drivers/firmware | |
parent | d683b96b072dc4680fc74964eca77e6a23d1fa6e (diff) |
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>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/efi/efi-pstore.c | 3 |
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) | |||
79 | &entry->var.DataSize, entry->var.Data); | 79 | &entry->var.DataSize, entry->var.Data); |
80 | size = entry->var.DataSize; | 80 | size = entry->var.DataSize; |
81 | 81 | ||
82 | *cb_data->buf = kmalloc(size, GFP_KERNEL); | 82 | *cb_data->buf = kmemdup(entry->var.Data, size, GFP_KERNEL); |
83 | if (*cb_data->buf == NULL) | 83 | if (*cb_data->buf == NULL) |
84 | return -ENOMEM; | 84 | return -ENOMEM; |
85 | memcpy(*cb_data->buf, entry->var.Data, size); | ||
86 | return size; | 85 | return size; |
87 | } | 86 | } |
88 | 87 | ||