staging: android: ram_console use kmemdup instead of kmalloc
authorGreg Dietsche <Gregory.Dietsche@cuw.edu>
Sun, 15 Jan 2012 20:44:34 +0000 (14:44 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2012 00:47:50 +0000 (16:47 -0800)
Replace kmalloc + memcpy will kmemdup in ram_console_late_init

Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ram_console.c

index 6d4d67924f22026236c0d4842f505773ae26dbf2..0cb3f3c227fce8453ce9b98a95643c7230a53704 100644 (file)
@@ -411,15 +411,14 @@ static int __init ram_console_late_init(void)
        if (ram_console_old_log == NULL)
                return 0;
 #ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT
-       ram_console_old_log = kmalloc(ram_console_old_log_size, GFP_KERNEL);
+       ram_console_old_log = kmemdup(ram_console_old_log_init_buffer,
+                                       ram_console_old_log_size, GFP_KERNEL);
        if (ram_console_old_log == NULL) {
                printk(KERN_ERR
                       "ram_console: failed to allocate buffer for old log\n");
                ram_console_old_log_size = 0;
                return 0;
        }
-       memcpy(ram_console_old_log,
-              ram_console_old_log_init_buffer, ram_console_old_log_size);
 #endif
        entry = create_proc_entry("last_kmsg", S_IFREG | S_IRUGO, NULL);
        if (!entry) {