Commit 8b849f6e authored by Sergey Shtylyov's avatar Sergey Shtylyov Committed by Jialin Zhang
Browse files

arm64: topology: fix possible overflow in amu_fie_setup()

stable inclusion
from stable-v5.10.150
commit 904f881b57360cf85de962d84d8614d94431f60e
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6D0XA

Reference:  https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=904f881b57360cf85de962d84d8614d94431f60e



--------------------------------

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: cd0ed03a ("arm64: use activity monitors for frequency invariance")
Signed-off-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Link: https://lore.kernel.org/r/01493d64-2bce-d968-86dc-11a122a9c07d@omp.ru


Signed-off-by: default avatarWill Deacon <will@kernel.org>

conflicts:
	arch/arm64/kernel/topology.c

Signed-off-by: default avatarLin Yujun <linyujun809@huawei.com>
Reviewed-by: default avatarZhang Jianhua <chris.zjh@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parent b2c428b7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment