OSDN Git Service

exynos: Fix out-of-bounds access in exynos4210_gcomp_find debug printf
authorFeng Jiang <jiangfeng@kylinos.cn>
Thu, 20 Apr 2023 09:21:13 +0000 (10:21 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 20 Apr 2023 09:21:13 +0000 (10:21 +0100)
commitc47a80cd14309727f5a0a0eb0fd26d4aa1b5c14c
tree2487ef15baaeedc85b20b3f7202edcdbdbbf929c
parentb3db996ffce758bd80181528110baac2b91cd531
exynos: Fix out-of-bounds access in exynos4210_gcomp_find debug printf

One of the debug printfs in exynos4210_gcomp_find() will
access outside the 's->g_timer.reg.comp[]' array if there
was no active comparator and 'res' is -1. Add a conditional
to avoid this.

This doesn't happen in normal use because the debug printfs
are by default not compiled in.

Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn>
Message-id: 20230404074506.112615-1-jiangfeng@kylinos.cn
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: Adjusted commit message to clarify that the overrun
only happens if you've enabled debug printfs]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/timer/exynos4210_mct.c