Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3704301pxk; Tue, 29 Sep 2020 04:16:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhrL8DcnJBQ0zkD2fU9HcwX1NTLhA2hz1+pBCebqy5sPJIKh5AGujtT/kQtRdsnp3L8atk X-Received: by 2002:a05:6402:1656:: with SMTP id s22mr2762879edx.160.1601378201421; Tue, 29 Sep 2020 04:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601378201; cv=none; d=google.com; s=arc-20160816; b=pjcqiSoZlSiEF2ZdfOktW+QTpzMf95vLfSbIepzz0cEIyaLp9GG2Qo2TBvt+ajtHbT 79rbEVU4Moa2rplJkJoIPoy1z/crlesi3729b9dXwE9gluHyN/Z0DMDpQzpbHdh7DI9r c/SpnHLHJuIAFqN2RCfIvGpwLoIXwL49oGsrMXdY9olfeVKbhIBH7yLaWGZaR08SV/dp nM1BM0BDWO5ROFqMYmIcrocjKMJ27zRWmkxBjB8djzxOUI3Xx5Zkl+wVWiSqVHl1RvHB G3gQJAJWBZB2c80Ka5c/PKRflr9LpauUxiTi27asIZKtVKCJj2fNQ79gFq2d4kYAQsnH XHHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QZNWuiUboDgm+1UWovfRRTNel5PV9tjpaZTFwT/TzIc=; b=k4Y6dL5R9TG84ZVcoNCZTRfz/dZVftt2X9fZjEnkxZVvpD1q7tGqlhANKGVqWwsfvF mTzLbAbwBDrYbNpq3p1g/HvpsOzerrgJIbEOdw0B2U5ueoflW6QkIu/2WnvlOgmldAG+ 4geYnPsfewQkpVZRxDet38lj4/JY09+SXicbtqBdYKI9dJCx8g58vgvMKpVswqQya0hY dh+U5vRv5VMm9E5yKwXA+Xd+OrVsl2GS/3lqgf2LKvD3+TVqAFd13Wr+OkBoWOQDtq5d dbG11k4wx3Lo/PD+WIyap4A7O/k6mW7pRSnpcdL+P2JnJOQftS98c/CZR8BFbQmoSow2 STNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tMvQHCAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u15si2397886ejx.239.2020.09.29.04.16.18; Tue, 29 Sep 2020 04:16:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tMvQHCAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729479AbgI2LO4 (ORCPT + 99 others); Tue, 29 Sep 2020 07:14:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:58884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729251AbgI2LOx (ORCPT ); Tue, 29 Sep 2020 07:14:53 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 631F521D41; Tue, 29 Sep 2020 11:14:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378092; bh=Kvg4TYtCRyYFiO+X6QdpTQiPvFHaswMRec8XtHXSmN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tMvQHCAZwZA9HaWRiDXCJE7IaUQggORW6DLRR6mmUcquA0tgMJ78mQAH63U324e62 6CO3ffpQTyF2IAodV6q8qRqdXz3yf9uFj5p+9IZo4lB4e0zgfq4AHS1a5BJu6PzBhr z810WILx6C3AeNV1bhGv8kXWDZ712EIr9F2+scX4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chanwoo Choi , Peter Geis , Dmitry Osipenko , Sasha Levin Subject: [PATCH 4.14 028/166] PM / devfreq: tegra30: Fix integer overflow on CPUs freq max out Date: Tue, 29 Sep 2020 12:59:00 +0200 Message-Id: <20200929105936.611988570@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105935.184737111@linuxfoundation.org> References: <20200929105935.184737111@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko [ Upstream commit 53b4b2aeee26f42cde5ff2a16dd0d8590c51a55a ] There is another kHz-conversion bug in the code, resulting in integer overflow. Although, this time the resulting value is 4294966296 and it's close to ULONG_MAX, which is okay in this case. Reviewed-by: Chanwoo Choi Tested-by: Peter Geis Signed-off-by: Dmitry Osipenko Signed-off-by: Chanwoo Choi Signed-off-by: Sasha Levin --- drivers/devfreq/tegra-devfreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/devfreq/tegra-devfreq.c b/drivers/devfreq/tegra-devfreq.c index 6627a7dce95c4..f6a2dd6b188fa 100644 --- a/drivers/devfreq/tegra-devfreq.c +++ b/drivers/devfreq/tegra-devfreq.c @@ -79,6 +79,8 @@ #define KHZ 1000 +#define KHZ_MAX (ULONG_MAX / KHZ) + /* Assume that the bus is saturated if the utilization is 25% */ #define BUS_SATURATION_RATIO 25 @@ -179,7 +181,7 @@ struct tegra_actmon_emc_ratio { }; static struct tegra_actmon_emc_ratio actmon_emc_ratios[] = { - { 1400000, ULONG_MAX }, + { 1400000, KHZ_MAX }, { 1200000, 750000 }, { 1100000, 600000 }, { 1000000, 500000 }, -- 2.25.1