X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=kernel%2Futsname.c;h=8a82b4b8ea52cb3690e25bf039eaf32ff5c8c079;hb=b305956abc3c50c52598bbf39b7a5f4850058ba8;hp=64d398f1244436cbdc4ede981dd927e39ee708b5;hpb=0f1bce41fed02e45f31c2409f29e69e1fedebcdc;p=karo-tx-linux.git diff --git a/kernel/utsname.c b/kernel/utsname.c index 64d398f12444..8a82b4b8ea52 100644 --- a/kernel/utsname.c +++ b/kernel/utsname.c @@ -12,10 +12,19 @@ #include #include #include -#include #include #include +static struct uts_namespace *create_uts_ns(void) +{ + struct uts_namespace *uts_ns; + + uts_ns = kmalloc(sizeof(struct uts_namespace), GFP_KERNEL); + if (uts_ns) + kref_init(&uts_ns->kref); + return uts_ns; +} + /* * Clone a new ns copying an original utsname, setting refcount to 1 * @old_ns: namespace to clone @@ -25,14 +34,13 @@ static struct uts_namespace *clone_uts_ns(struct uts_namespace *old_ns) { struct uts_namespace *ns; - ns = kmalloc(sizeof(struct uts_namespace), GFP_KERNEL); + ns = create_uts_ns(); if (!ns) return ERR_PTR(-ENOMEM); down_read(&uts_sem); memcpy(&ns->name, &old_ns->name, sizeof(ns->name)); up_read(&uts_sem); - kref_init(&ns->kref); return ns; }