selinux: Return directly after a failed kzalloc() in cat_read()
authorMarkus Elfring <elfring@users.sourceforge.net>
Sat, 14 Jan 2017 20:20:43 +0000 (21:20 +0100)
committerPaul Moore <paul@paul-moore.com>
Wed, 29 Mar 2017 13:54:48 +0000 (09:54 -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 a8389396e9a95331d0f53c4ba0fc1fbadcfc1760..36285d12c2e99074ceed03c65860b6a080274cf5 100644 (file)
@@ -1637,10 +1637,9 @@ static int cat_read(struct policydb *p, struct hashtab *h, void *fp)
        __le32 buf[3];
        u32 len;
 
-       rc = -ENOMEM;
        catdatum = kzalloc(sizeof(*catdatum), GFP_ATOMIC);
        if (!catdatum)
-               goto bad;
+               return -ENOMEM;
 
        rc = next_entry(buf, fp, sizeof buf);
        if (rc)