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: 163535 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp614170vqs; Thu, 9 Nov 2023 10:09:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmG429KBIqbfM8nXR9PP9IB7XnYQr7BGj1icY2r8uz7yPs8uch2PCiKdW6/0CwT6xYO7nN X-Received: by 2002:a17:902:9a93:b0:1cc:6b5a:a2f1 with SMTP id w19-20020a1709029a9300b001cc6b5aa2f1mr5441010plp.8.1699553371952; Thu, 09 Nov 2023 10:09:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699553371; cv=none; d=google.com; s=arc-20160816; b=wC9HvT+MvvAuoTqAofbiuG7oITSfmhQ9bNJGWkDOJ5QgIqqnhTlErw6j0cXmdfG/4I DdWjngsPTP1q18/DEYH57up2s4+4pSmqDQKc9qTNLsk19+5zxhnAUdU5lXgl+eipo9/I p0wbu9CmyBke0vzAAPejYodA1Mp0wkk6CGygJXqJ+INstiYnP6MjgkJw3nNL5fdAQDkg eNQnsmODUNNZh2s63CtsuTlvDGG22noG0QiLZosYTt9nju7eh6yv0R01GOKYNjehWZOE bmRrykcdijOOQBs/FhG2zaI/kv+tdbReT3UDMAPpuusbiLvi0ANHprE2X8exAljSVnqr xlMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language:cc:to :subject:from:user-agent:mime-version:date:message-id; bh=tlpHyCsRyYO95Ym79pM1rQv6P3csItrNZjgrfqlGx8E=; fh=lwgto5dPFEWoYNQTiWX9fbaxzWBM6YuPo0/1akwU8Vc=; b=SSQ7vdhPsuAcEuQC/EjIuJPXN+bNCYtLeiuEHRPHZmO2oERQwrtGgJMoXBocfJKuwp pF6MNZyD4Sna6cJjK2OFF2qpiMRdTqKCJdzpn3q5EtTgNlE5t+98mrbhCKv+5GH9AlHn YN8/L7iRoAJsjaEaTWA0Nk0C7J/KXJM2iOqaxTHQdk4u6XvIS24Q/0YqSxdDsisRlP84 yNigxEH9tEy55sgc/0SdYWcPhEPRLImKaosCFhOs5VeJaFauFhoBYTV8MILSIYYMD6Rk Utjl5Lq1lIEpYSbr5PkBC8MerqZL5Ex4DsVLJmM5lWMjlW5M6U3DcNYNVmPbMr9clDDD J1Mw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id m4-20020a170902db0400b001c9fe071f2csi5817205plx.105.2023.11.09.10.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 10:09:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DBD0183C38C7; Thu, 9 Nov 2023 10:09:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344928AbjKISJO (ORCPT + 31 others); Thu, 9 Nov 2023 13:09:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231478AbjKISJM (ORCPT ); Thu, 9 Nov 2023 13:09:12 -0500 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 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 09 Nov 2023 10:09:29 -0800 (PST) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782110876519534510 X-GMAIL-MSGID: 1782110876519534510 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