selinux: Return directly after a failed kzalloc() in perm_read()
authorMarkus Elfring <elfring@users.sourceforge.net>
Sun, 15 Jan 2017 10:20:13 +0000 (11:20 +0100)
committerPaul Moore <paul@paul-moore.com>
Wed, 29 Mar 2017 15:30:51 +0000 (11:30 -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 99ee0ee2d92afd256243a3250ac24c65e474a853..5ca2d26ecf7fe4df31832b20d2525adf6d393ec9 100644 (file)
@@ -1118,10 +1118,9 @@ static int perm_read(struct policydb *p, struct hashtab *h, void *fp)
        __le32 buf[2];
        u32 len;
 
-       rc = -ENOMEM;
        perdatum = kzalloc(sizeof(*perdatum), GFP_KERNEL);
        if (!perdatum)
-               goto bad;
+               return -ENOMEM;
 
        rc = next_entry(buf, fp, sizeof buf);
        if (rc)