From patchwork Thu Nov 9 18:08:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Kiryushin X-Patchwork-Id: 742868 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B45A920B14 for ; Thu, 9 Nov 2023 18:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from relay164.nicmail.ru (relay164.nicmail.ru [91.189.117.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7DC0CE; Thu, 9 Nov 2023 10:09:07 -0800 (PST) Received: from [10.28.138.151] (port=11776 helo=[192.168.95.111]) by relay.hosting.mail.nic.ru with esmtp (Exim 5.55) (envelope-from ) id 1r19Sf-00020H-DZ; Thu, 09 Nov 2023 21:09:01 +0300 Received: from [87.245.155.195] (account kiryushin@ancud.ru HELO [192.168.95.111]) by incarp1103.mail.hosting.nic.ru (Exim 5.55) with id 1r19Sf-001rie-0S; Thu, 09 Nov 2023 21:09:01 +0300 Message-ID: <430a1271-a45c-4f5a-90c7-a62703ac7cf4@ancud.ru> Date: Thu, 9 Nov 2023 21:08:59 +0300 Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Nikita Kiryushin Subject: [PATCH] ACPI: LPIT: fix u32 multiplication overflow To: "Rafael J. Wysocki" Cc: Len Brown , Srinivas Pandruvada , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Content-Language: en-US X-MS-Exchange-Organization-SCL: -1 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: eeb2d80d502a ("ACPI / LPIT: Add Low Power Idle Table (LPIT) support") Signed-off-by: Nikita Kiryushin --- drivers/acpi/acpi_lpit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_lpit.c b/drivers/acpi/acpi_lpit.c index c5598b6d5db8..794962c5c88e 100644 --- a/drivers/acpi/acpi_lpit.c +++ b/drivers/acpi/acpi_lpit.c @@ -105,7 +105,7 @@ static void lpit_update_residency(struct lpit_residency_info *info, return; 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; -- 2.34.1