clocksource/drivers/exynos_mct: Handle DTS with higher number of interrupts
authorKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Sun, 20 Feb 2022 10:38:15 +0000 (11:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:23:08 +0000 (14:23 +0200)
commita81de4315ecf5a401212154dad0168a0cb9ed857
tree28801238be94dde5c948d4dc453e828dbfa9c3ba
parente34ba9ff04eeecd4b2f406973288ea50fbbb129b
clocksource/drivers/exynos_mct: Handle DTS with higher number of interrupts

[ Upstream commit ab8da93dc06d82f464c47ab30e6c75190702f369 ]

The driver statically defines maximum number of interrupts it can
handle, however it does not respect that limit when configuring them.
When provided with a DTS with more interrupts than assumed, the driver
will overwrite static array mct_irqs leading to silent memory
corruption.

Validate the interrupts coming from DTS to avoid this.  This does not
change the fact that such DTS might not boot at all, because it is
simply incompatible, however at least some warning will be printed.

Fixes: 36ba5d527e95 ("ARM: EXYNOS: add device tree support for MCT controller driver")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Link: https://lore.kernel.org/r/20220220103815.135380-1-krzysztof.kozlowski@canonical.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clocksource/exynos_mct.c