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>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
 
        if (!bootinfo_size)
                return -EINVAL;
 
-       bootinfo_copy = kmalloc(bootinfo_size, GFP_KERNEL);
+       bootinfo_copy = kmemdup(bootinfo_tmp, bootinfo_size, GFP_KERNEL);
        if (!bootinfo_copy)
                return -ENOMEM;
 
-       memcpy(bootinfo_copy, bootinfo_tmp, bootinfo_size);
-
        pde = proc_create_data("bootinfo", 0400, NULL, &bootinfo_fops, NULL);
        if (!pde) {
                kfree(bootinfo_copy);