[PATCH] kernel/nsproxy.c: use kmemdup()
authorAlexey Dobriyan <adobriyan@gmail.com>
Fri, 20 Oct 2006 06:29:12 +0000 (23:29 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 20 Oct 2006 17:26:44 +0000 (10:26 -0700)
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/nsproxy.c

index 6ebdb82..674aceb 100644 (file)
@@ -44,11 +44,9 @@ static inline struct nsproxy *clone_namespaces(struct nsproxy *orig)
 {
        struct nsproxy *ns;
 
-       ns = kmalloc(sizeof(struct nsproxy), GFP_KERNEL);
-       if (ns) {
-               memcpy(ns, orig, sizeof(struct nsproxy));
+       ns = kmemdup(orig, sizeof(struct nsproxy), GFP_KERNEL);
+       if (ns)
                atomic_set(&ns->count, 1);
-       }
        return ns;
 }