summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2020-04-29 07:30:53 +0000
committerPaul Moore <paul@paul-moore.com>2020-05-01 15:02:14 -0400
commit4c09f8b6913a779ca0c70ea8058bf21537eebb3b (patch)
tree343c931f942fdd37e80360b64309eb14e62aa7b9 /security
parent9521eb3ea19a828d8fd59a2785338fd742dbcf31 (diff)
selinux: fix error return code in policydb_read()
Fix to return negative error code -ENOMEM from the kvcalloc() error handling case instead of 0, as done elsewhere in this function. Fixes: acdf52d97f82 ("selinux: convert to kvmalloc") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security')
-rw-r--r--security/selinux/ss/policydb.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 1c0041576643..a42369dd96a9 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -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);