mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
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 7741892164)
Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user