提交 77418921 编写于 作者: T Thomas Meyer 提交者: Tony Luck

efi, pstore: Cocci spatch "memdup.spatch"

Change a kmalloc() + memcpy() pair for a single kmemdup() call.
Signed-off-by: NThomas Meyer <thomas@m3y3r.de>
Acked-by: NKees Cook <keescook@chromium.org>
Signed-off-by: NTony Luck <tony.luck@intel.com>
上级 d683b96b
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册