Skip to content

Commit

Permalink
staging: android: ram_console use kmemdup instead of kmalloc
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Greg Dietsche authored and Greg Kroah-Hartman committed Feb 9, 2012
1 parent e96045a commit 28aa41f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/staging/android/ram_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 28aa41f

Please sign in to comment.