Skip to content

Commit

Permalink
selinux: Return directly after a failed kzalloc() in perm_read()
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 442ca4d commit 7befb75
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 @@ -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)
Expand Down

0 comments on commit 7befb75

Please sign in to comment.