Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3755043pxk; Tue, 29 Sep 2020 05:35:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3J79hgp7wIZIUbcLKdQzDAJSI+quG2q+jpdOZlGyK0E/RyC2DDiiroNf5/CD93+TPogjc X-Received: by 2002:a17:906:fa0a:: with SMTP id lo10mr1419404ejb.22.1601382944036; Tue, 29 Sep 2020 05:35:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601382944; cv=none; d=google.com; s=arc-20160816; b=qWl1XzLe3x+9zNc03bPi8W/NuPg7aQ9/XOJEbQ0odG9CAMrGiVReUcBFZkwTtrPFm1 xemBRm/FJ/xXS896Pb5s5HgIAVyIehRdVXOUpPoR/E+XJ/+fiHObfPKA2/jX/00KTEGF TVyTZUWi3YrIe2KetXKybqMUecicC0oZa2e5wFYuSuD/9BSHSvLYqNN8l2Er4i5s5Le1 tddsf5fLeRYKs6REMVnRXy3mGm83L47xsA1OuJvdwaqMJR1jeHYApJsmQ75DVksCnbG1 gPa4ieC41SLMS1/nx0odC9EgFQSi5Wf9Q+FRHYCjd9WPaMnsbhuBEO0gAc6A7v0slrCL 6OKA== 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=Fnur1ehA7p+4R+29Ix1EKzeU8DMAPrNFEjnu3oXwQBg=; b=wEsCxVFudtMIRkEcMZT6sT3+K5Io7Viae5tHPxNdrLJ3XX3FIITps00tu2haynCW96 OFizhhy6wlc9G3etnn+ZITO9pYABqyQxAmokAxZmTFW2TCUd4ch05imVU8hyqW8PkoUz gp1zs+u5gdWLtwaRiJA1yGSKqoEw0XqT2rBNojaSgZW46FKi4hUSGzgu3Utvo6ezv59w Py9ECbeF1jGcqY/+Hj3ehweIOPKx2ZNqeR2wUo0Wtow6lyeMky8upEfNrFY73zI9nMi2 ysI3YoolV1nH4QPjembSb+h140lK5h3aH/pSequHedDgntmGrx77uPUhJdhS81l8oSEh EumA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Vj880f5K; 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 v15si2715804edw.67.2020.09.29.05.35.20; Tue, 29 Sep 2020 05:35:44 -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=Vj880f5K; 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 S1733019AbgI2McS (ORCPT + 99 others); Tue, 29 Sep 2020 08:32:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:37026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729546AbgI2LXB (ORCPT ); Tue, 29 Sep 2020 07:23:01 -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 C9A4521D7D; Tue, 29 Sep 2020 11:20:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601378452; bh=UjL3BskRwLRof0uTzYp0icPKMM6aheG/65eSWsggAEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vj880f5K9LT5Di0DAcHqnMhqHpNdbDwkZYbLUGJIpK8KLOXLo7XmzPDJ+zM/KsqPW 1tGT8UdlZfvQxG0zHg6OJig7Tyt+xACisoKiqxizrV5viBAL/cLzm+N0PpIfYBkF5V 1x3QR7UXqudrB3rhMo7Gx9V5Bt+EyK5CspB7wIyA= 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.19 019/245] PM / devfreq: tegra30: Fix integer overflow on CPUs freq max out Date: Tue, 29 Sep 2020 12:57:50 +0200 Message-Id: <20200929105947.929201703@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929105946.978650816@linuxfoundation.org> References: <20200929105946.978650816@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 06768074d2d82..479d9575e1245 100644 --- a/drivers/devfreq/tegra-devfreq.c +++ b/drivers/devfreq/tegra-devfreq.c @@ -80,6 +80,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 @@ -180,7 +182,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