From: Alexey Dobriyan Date: Fri, 20 Oct 2006 06:29:12 +0000 (-0700) Subject: [PATCH] kernel/nsproxy.c: use kmemdup() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=e05d722e4555cd54677b4c8431d9e81fd047ef7a;p=openwrt%2Fstaging%2Fblogic.git [PATCH] kernel/nsproxy.c: use kmemdup() Signed-off-by: Alexey Dobriyan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index 6ebdb82a0ce4..674aceb7335a 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c @@ -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; }