Skip to content

Commit 56d2eed

Browse files
nkiryushinrafaeljw
authored andcommitted
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: eeb2d80 ("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>
1 parent 98b1cc8 commit 56d2eed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/acpi/acpi_lpit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static void lpit_update_residency(struct lpit_residency_info *info,
105105
return;
106106

107107
info->frequency = lpit_native->counter_frequency ?
108-
lpit_native->counter_frequency : tsc_khz * 1000;
108+
lpit_native->counter_frequency : mul_u32_u32(tsc_khz, 1000U);
109109
if (!info->frequency)
110110
info->frequency = 1;
111111

0 commit comments

Comments
 (0)