]> git.itanic.dy.fi Git - linux-stable/commit
arm64: topology: fix possible overflow in amu_fie_setup()
authorSergey Shtylyov <s.shtylyov@omp.ru>
Fri, 16 Sep 2022 20:17:07 +0000 (23:17 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Sep 2022 09:11:45 +0000 (11:11 +0200)
commit3c3edb82d67b2be9231174ac2af4af60d4af7549
tree111acb82db298965e6a443121f58809ba07ecadc
parent2427a04bce8648a2ec47bf9e3f57253926a5ce9d
arm64: topology: fix possible overflow in amu_fie_setup()

commit d4955c0ad77dbc684fc716387070ac24801b8bca upstream.

cpufreq_get_hw_max_freq() returns max frequency in kHz as *unsigned int*,
while freq_inv_set_max_ratio() gets passed this frequency in Hz as 'u64'.
Multiplying max frequency by 1000 can potentially result in overflow --
multiplying by 1000ULL instead should avoid that...

Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.

Fixes: cd0ed03a8903 ("arm64: use activity monitors for frequency invariance")
Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Link: https://lore.kernel.org/r/01493d64-2bce-d968-86dc-11a122a9c07d@omp.ru
Signed-off-by: Will Deacon <will@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/kernel/topology.c