selinux: Return directly after a failed kzalloc() in roles_init()
authorMarkus Elfring <elfring@users.sourceforge.net>
Sun, 15 Jan 2017 11:10:09 +0000 (12:10 +0100)
committerPaul Moore <paul@paul-moore.com>
Wed, 29 Mar 2017 15:39:17 +0000 (11:39 -0400)
Return directly after a call of the function "kzalloc" failed
at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/selinux/ss/policydb.c

index 5ca2d26ecf7fe4df31832b20d2525adf6d393ec9..658247f98dc13671d747d97b0e55087d3b1e8402 100644 (file)
@@ -178,10 +178,9 @@ static int roles_init(struct policydb *p)
        int rc;
        struct role_datum *role;
 
-       rc = -ENOMEM;
        role = kzalloc(sizeof(*role), GFP_KERNEL);
        if (!role)
-               goto out;
+               return -ENOMEM;
 
        rc = -EINVAL;
        role->value = ++p->p_roles.nprim;