Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c38e791 authored by Nikita Kiryushin's avatar Nikita Kiryushin Committed by Greg Kroah-Hartman
Browse files

ACPI: LPIT: Avoid u32 multiplication overflow



[ Upstream commit 56d2eeda87995245300836ee4dbd13b002311782 ]

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: eeb2d80d ("ACPI / LPIT: Add Low Power Idle Table (LPIT) support")
Signed-off-by: default avatarNikita Kiryushin <kiryushin@ancud.ru>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 1e3a2b9b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ static void lpit_update_residency(struct lpit_residency_info *info,
				 struct acpi_lpit_native *lpit_native)
{
	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)
		info->frequency = 1;