1
0
Fork 0

selinux: fix error return code in policydb_read()

[ Upstream commit 4c09f8b691 ]

Fix to return negative error code -ENOMEM from the kvcalloc() error
handling case instead of 0, as done elsewhere in this function.

Fixes: acdf52d97f ("selinux: convert to kvmalloc")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5.4-rM2-2.2.x-imx-squashed
Wei Yongjun 2020-04-29 07:30:53 +00:00 committed by Greg Kroah-Hartman
parent 86dced2417
commit b2083327ea
1 changed files with 1 additions and 0 deletions

View File

@ -2496,6 +2496,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);