Skip to content

Commit

Permalink
selinux: Return directly after a failed kzalloc() in roles_init()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Markus Elfring authored and Paul Moore committed Mar 29, 2017
1 parent 7befb75 commit ebd2b47
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions security/selinux/ss/policydb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ebd2b47

Please sign in to comment.