diff options
author | Andrzej Hajda <a.hajda@samsung.com> | 2015-08-07 09:59:11 +0200 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-08-18 19:34:43 +1000 |
commit | fc9e9cbf4e48f28525edd27e285820988f1a54b1 (patch) | |
tree | ff784f97209712e4fe79c90af10ecc7d3e7f6e42 /arch/powerpc | |
parent | 2e16acc5ee3626bcd32e2252c8260b65efde7b36 (diff) |
powerpc/nvram: use kmemdup rather than duplicating its implementation
The patch was generated using fixed coccinelle semantic patch
scripts/coccinelle/api/memdup.cocci [1].
[1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/nvram_64.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c index 1e703f8ebad4..6f6597b3966b 100644 --- a/arch/powerpc/kernel/nvram_64.c +++ b/arch/powerpc/kernel/nvram_64.c @@ -541,10 +541,9 @@ static ssize_t nvram_pstore_read(u64 *id, enum pstore_type_id *type, time->tv_sec = be64_to_cpu(oops_hdr->timestamp); time->tv_nsec = 0; } - *buf = kmalloc(length, GFP_KERNEL); + *buf = kmemdup(buff + hdr_size, length, GFP_KERNEL); if (*buf == NULL) return -ENOMEM; - memcpy(*buf, buff + hdr_size, length); kfree(buff); if (err_type == ERR_TYPE_KERNEL_PANIC_GZ) |