mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
ACPI: LPIT: Avoid u32 multiplication overflow
In lpit_update_residency() there is a possibility of overflow
in multiplication, if tsc_khz is large enough (> UINT_MAX/1000).
Change multiplication to mul_u32_u32().
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: eeb2d80d50
("ACPI / LPIT: Add Low Power Idle Table (LPIT) support")
Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
98b1cc82c4
commit
56d2eeda87
@ -105,7 +105,7 @@ static void lpit_update_residency(struct lpit_residency_info *info,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
info->frequency = lpit_native->counter_frequency ?
|
info->frequency = lpit_native->counter_frequency ?
|
||||||
lpit_native->counter_frequency : tsc_khz * 1000;
|
lpit_native->counter_frequency : mul_u32_u32(tsc_khz, 1000U);
|
||||||
if (!info->frequency)
|
if (!info->frequency)
|
||||||
info->frequency = 1;
|
info->frequency = 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user