Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp884956pxk; Thu, 17 Sep 2020 20:17:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyUPgnp8oDiBowxsn/B2GWXCzIDC2GZdqyvA6PL2LSHM6m1xFxMZWjr1Fyk1q69a3KetyR X-Received: by 2002:a17:906:a845:: with SMTP id dx5mr33121896ejb.543.1600399071215; Thu, 17 Sep 2020 20:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600399071; cv=none; d=google.com; s=arc-20160816; b=E27hrqJRye0IeKsCwC1Dy2Tkg8Qu4/Qe31NTn5G2PHgjVl215vga+JsWGpUkL6S9yC HJ0401axsOBQCu3s4/M3O7PaPkX2g0vwAmLJZnUkBCfOiUNryFiyiObwFIPSw50cVQiw I+zyAwSWaTPHRUC4RdNUYlh3dGxbP1DCBNCWr9rDQTVqkNTtAl1GfCDTG/zdP49cls3u /0E2IMKr0LWIxQ9Rm7y8H2wea4GOjcerQagSJi4igW23OeRsX3emYWl7UTfK6pznPpON /qxvSBR+hBnAv+XhfztZ//rCEzKpUGeXRH4e9AdHqeofiw6OblbpsRVnu3O24psi1rUv eK3g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RNOE231FMvTThJWDnoDJaZnPZULmXP6Ww6t9vB14bqU=; b=sQLP8A4QM3kaM4I/eXlbHu6PwfSsamr9AUlRnUd1gE6sWTphfPAna4j/+x/LvLXmTP SfdKceEnttguJ/0XVeolbmRVejLC3OWq0vSwrM+iFLF0gqsW7szWTbDW6uune+Dk53Vu E1QW7KlCc9NWtqIHLcoVIRh57gVCkFdJrE5kHay9mZELEwaC1AMQq46VCn3Nss1qSy8C ENhzTw66ze0F1Va6Ya+7ThrfdbXu4ed17/in1uyJ/6Nh9eC7T3gepfPiJ16RLg3dD/Fd l1i+ruMSARQR8tpcXm0gfYBydIzLDKIA14uxVToIwztHSUboueiVOssZ6jslkHj3ncku lXmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GcnlEkM9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l21si1097853edq.277.2020.09.17.20.17.28; Thu, 17 Sep 2020 20:17:51 -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=GcnlEkM9; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726930AbgIRDOk (ORCPT + 99 others); Thu, 17 Sep 2020 23:14:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:45808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726479AbgIRCBo (ORCPT ); Thu, 17 Sep 2020 22:01:44 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B79A1235FA; Fri, 18 Sep 2020 02:01:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394503; bh=olcSovhd3mqxcStuyRQwJpR7Kpxz7YoVX9eWDOiAVEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GcnlEkM9DpS3aOEsWMtitzrrdI6LnJVjEZ62LzECo7UGaW21gPspj7tKkFKBjJFLp CwsbihE6feT12eXerKTnUKI915QnYq7NIcsy+7tjSOZj2afnTa+dR1h9+0LSmOo08b G7SXprcM3Tvmlwm0xoyVY7a6N7LSUVTzBqIhe69c= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dmitry Osipenko , Chanwoo Choi , Peter Geis , Sasha Levin , linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 027/330] PM / devfreq: tegra30: Fix integer overflow on CPU's freq max out Date: Thu, 17 Sep 2020 21:56:07 -0400 Message-Id: <20200918020110.2063155-27-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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