selinux: Return directly after a failed kzalloc() in type_read()
authorMarkus Elfring <elfring@users.sourceforge.net>
Sat, 14 Jan 2017 21:15:54 +0000 (22:15 +0100)
committerPaul Moore <paul@paul-moore.com>
Wed, 29 Mar 2017 15:20:07 +0000 (11:20 -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 9a90953974b85b25de3531f3873a3d015d0b6ccd..fd58de5a83adf61d2560a30cc74e788c605150b3 100644 (file)
@@ -1469,10 +1469,9 @@ static int type_read(struct policydb *p, struct hashtab *h, void *fp)
        __le32 buf[4];
        u32 len;
 
-       rc = -ENOMEM;
        typdatum = kzalloc(sizeof(*typdatum), GFP_KERNEL);
        if (!typdatum)
-               goto bad;
+               return -ENOMEM;
 
        if (p->policyvers >= POLICYDB_VERSION_BOUNDARY)
                to_read = 4;