]> git.baikalelectronics.ru Git - kernel.git/commit
ima: Fix misuse of dereference of pointer in template_desc_init_fields()
authorXiu Jianfeng <xiujianfeng@huawei.com>
Sat, 12 Nov 2022 09:27:19 +0000 (17:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:03 +0000 (11:41 +0100)
commit1fd3a6517ad9c95b9ae5b0929efde78a940db042
treec397a7a87f14c7c6ba508a3ff28f4280ec7c6d9f
parentac3cfef5a66532df0f50e3ffd12d9f3503280012
ima: Fix misuse of dereference of pointer in template_desc_init_fields()

[ Upstream commit 47460872ad2c8f019255d1df5451896334d057dd ]

The input parameter @fields is type of struct ima_template_field ***, so
when allocates array memory for @fields, the size of element should be
sizeof(**field) instead of sizeof(*field).

Actually the original code would not cause any runtime error, but it's
better to make it logically right.

Fixes: 2c7192a88a90 ("ima: new templates management mechanism")
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
security/integrity/ima/ima_template.c