Skip to content

Commit

Permalink
selinux: fix error return code in policydb_read()
Browse files Browse the repository at this point in the history
Fix to return negative error code -ENOMEM from the kvcalloc() error
handling case instead of 0, as done elsewhere in this function.

Fixes: acdf52d ("selinux: convert to kvmalloc")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
  • Loading branch information
Wei Yongjun authored and Paul Moore committed May 1, 2020
1 parent 9521eb3 commit 4c09f8b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions security/selinux/ss/policydb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2638,6 +2638,7 @@ int policydb_read(struct policydb *p, void *fp)
if (rc)
goto bad;

rc = -ENOMEM;
p->type_attr_map_array = kvcalloc(p->p_types.nprim,
sizeof(*p->type_attr_map_array),
GFP_KERNEL);
Expand Down

0 comments on commit 4c09f8b

Please sign in to comment.