From: Markus Elfring Date: Sat, 14 Jan 2017 21:20:25 +0000 (+0100) Subject: selinux: Return directly after a failed kzalloc() in role_read() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ea6e2f7d12921f336def7398805ee3b1619e2f4b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git selinux: Return directly after a failed kzalloc() in role_read() Return directly after a call of the function "kzalloc" failed at the beginning. Signed-off-by: Markus Elfring Signed-off-by: Paul Moore --- diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c index fd58de5a83ad..30f29c669e32 100644 --- a/security/selinux/ss/policydb.c +++ b/security/selinux/ss/policydb.c @@ -1412,10 +1412,9 @@ static int role_read(struct policydb *p, struct hashtab *h, void *fp) __le32 buf[3]; u32 len; - rc = -ENOMEM; role = kzalloc(sizeof(*role), GFP_KERNEL); if (!role) - goto bad; + return -ENOMEM; if (p->policyvers >= POLICYDB_VERSION_BOUNDARY) to_read = 3;