]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ep93xx: clock: Fix off by one in ep93xx_div_recalc_rate()
authorDan Carpenter <alexander.sverdlin@gmail.com>
Wed, 11 Sep 2024 07:39:15 +0000 (10:39 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:29:40 +0000 (16:29 +0200)
commit66e78ade976dbd9bea09166aa8d66afc0963cde4
tree5032a47c2798cce4c23a68cf5960dfb3aa33f6bd
parentca64edd7ae93402af2596a952e0d94d545e2b9c0
ep93xx: clock: Fix off by one in ep93xx_div_recalc_rate()

[ Upstream commit c7f06284a6427475e3df742215535ec3f6cd9662 ]

The psc->div[] array has psc->num_div elements.  These values come from
when we call clk_hw_register_div().  It's adc_divisors and
ARRAY_SIZE(adc_divisors)) and so on.  So this condition needs to be >=
instead of > to prevent an out of bounds read.

Fixes: 9645ccc7bd7a ("ep93xx: clock: convert in-place to COMMON_CLK")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Reviewed-by: Nikita Shubin <nikita.shubin@maquefel.me>
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://lore.kernel.org/r/1caf01ad4c0a8069535813c26c7f0b8ea011155e.camel@linaro.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm/mach-ep93xx/clock.c