linux-yocto/drivers/tee
Jann Horn cdc1b9b47b tee: Prevent size calculation wraparound on 32-bit kernels
[ Upstream commit 39bb67edcc ]

The current code around TEE_IOCTL_PARAM_SIZE() is a bit wrong on
32-bit kernels: Multiplying a user-provided 32-bit value with the
size of a structure can wrap around on such platforms.

Fix it by using saturating arithmetic for the size calculation.

This has no security consequences because, in all users of
TEE_IOCTL_PARAM_SIZE(), the subsequent kcalloc() implicitly checks
for wrapping.

Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Tested-by: Rouven Czerwinski <rouven.czerwinski@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-27 11:08:57 +01:00
..
amdtee
optee
Kconfig
Makefile
tee_core.c tee: Prevent size calculation wraparound on 32-bit kernels 2025-06-27 11:08:57 +01:00
tee_private.h
tee_shm_pool.c
tee_shm.c