Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3743578pxk; Tue, 29 Sep 2020 05:18:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhB3wkrPn7BH+8EM5ubiwWwVvAyY/WjcPCFYCQWYtgBiXc1p1NtPRED6vA/t/lx8nkIk4s X-Received: by 2002:aa7:d981:: with SMTP id u1mr2864214eds.250.1601381938413; Tue, 29 Sep 2020 05:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601381938; cv=none; d=google.com; s=arc-20160816; b=DCgeQSwC7VNKSxbXmDKsXV0ByJY4tbMWgiO1Puzkz+7dlzJxp+ESnie0sFGUvPOEwY TolNRdYcVvz5WiKOYsqoYiMz6Bx9hUQiu98iYaN7LYXreBuxS3A6JXlJ6QLhiVqXflwT Q3UWyrW0F+wSAT5xw6VaPj0UkeLEUCgnYPoSzQWAn/JUvGXdJSQAEtVh10m5yyhlyiIR WmfuaYzFSHf4W5qkG8mnpFoWZ7M8ENuCLH0bRYPZyjNB0xP2sOGqA5l1kdBKVDgBmUxv D3XGuNDZTwKNfULYzaxloWkz1QvQ9TjJM7YcXfCHvPN3eCcGGNRkueaPIoSlx0cjt17O kOyA== 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=RNOE231FMvTThJWDnoDJaZnPZULmXP6Ww6t9vB14bqU=; b=G9OlL3ZOnstU/jgrA51uKiOvYwd/pi7KTgJHazr5TE05rNJv2GIxmgLx5WbE5j+gix 6jAAdLI5UM0krszK9/qs2Q0CyW4qe6eSGtuZi23dMy8/flM8L0RYiTQYsJfukJjM4S2A /MZkiniL4YtfwdXOjXXPBiYQadSTl6L+9TBuoKZSt6Nwya0gaodsVdbICaEKa7u+2OgB ugOXAXk2J1Z/OXR4OJ1IvhoNFaQeSPv/jYFbJQzmaSqTFPJZPguxnlp5k95xb7brHZbZ IieVGOLj5BucAgksrpT0qnp10zMYkp0y61KNUjz5ZDnlSLhc956lCXCFJ8vwIDE7lpm2 DQoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yUPQin2n; 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 r15si2752303edo.318.2020.09.29.05.18.35; Tue, 29 Sep 2020 05:18:58 -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=yUPQin2n; 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 S1730125AbgI2MP1 (ORCPT + 99 others); Tue, 29 Sep 2020 08:15:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:50296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730086AbgI2Lh2 (ORCPT ); Tue, 29 Sep 2020 07:37:28 -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 97F5E23B08; Tue, 29 Sep 2020 11:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379197; bh=olcSovhd3mqxcStuyRQwJpR7Kpxz7YoVX9eWDOiAVEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yUPQin2n2BsCpg2efITb1DG2rT4l2PKX/U8yXVVSWJJtOIf4AhIP9GB2bryfTQPmR HqHmgToISzzhnRwNWDCJZLdpBuANhvukWN/e5pCsr+imTRTL5oZ2iPMtN+IZh5sS7J 29aOWeDPQYBQfWkiCMOoTMRIXFxlf1QTAUBg5mgM= 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 5.4 025/388] PM / devfreq: tegra30: Fix integer overflow on CPUs freq max out Date: Tue, 29 Sep 2020 12:55:56 +0200 Message-Id: <20200929110011.704656569@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929110010.467764689@linuxfoundation.org> References: <20200929110010.467764689@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/tegra30-devfreq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c index a6ba75f4106d8..e273011c83fbd 100644 --- a/drivers/devfreq/tegra30-devfreq.c +++ b/drivers/devfreq/tegra30-devfreq.c @@ -68,6 +68,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 @@ -169,7 +171,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