Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] kstrdup: convert a few existing implementations

Convert a bunch of strdup() implementations and their callers to the new
kstrdup(). A few remain, for example see sound/core, and there are tons of
open coded strdup()'s around. Sigh. But this is a start.

Signed-off-by: Robert Love <rml@novell.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Robert Love and committed by
Linus Torvalds
dfe52244 543537bd

+2 -6
+2 -6
arch/um/kernel/process_kern.c
··· 8 8 #include "linux/kernel.h" 9 9 #include "linux/sched.h" 10 10 #include "linux/interrupt.h" 11 + #include "linux/string.h" 11 12 #include "linux/mm.h" 12 13 #include "linux/slab.h" 13 14 #include "linux/utsname.h" ··· 323 322 324 323 char *uml_strdup(char *string) 325 324 { 326 - char *new; 327 - 328 - new = kmalloc(strlen(string) + 1, GFP_KERNEL); 329 - if(new == NULL) return(NULL); 330 - strcpy(new, string); 331 - return(new); 325 + return kstrdup(string, GFP_KERNEL); 332 326 } 333 327 334 328 int copy_to_user_proc(void __user *to, void *from, int size)