From patchwork Wed Sep 14 23:08:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hotran X-Patchwork-Id: 9332671 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8AE5D6077A for ; Wed, 14 Sep 2016 23:09:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76F1C28C4D for ; Wed, 14 Sep 2016 23:09:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6B6DB28C50; Wed, 14 Sep 2016 23:09:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1242C28C4D for ; Wed, 14 Sep 2016 23:09:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765069AbcINXJJ (ORCPT ); Wed, 14 Sep 2016 19:09:09 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:33388 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765112AbcINXIj (ORCPT ); Wed, 14 Sep 2016 19:08:39 -0400 Received: by mail-pf0-f176.google.com with SMTP id g202so10155604pfb.0 for ; Wed, 14 Sep 2016 16:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apm.com; s=apm; h=from:to:cc:subject:date:message-id; bh=jmT/FEAf7Fys64Ojgj0ewSV3F2AVs/4QT7Sz1EpKb2A=; b=WwWXc9CfZROyJ5MDkWDfGKa+6EPXFF2Ssv6jiiNlYZv0NXHMACAMFLSIDGoEtJtHkw dK5w9QhyG8/RA+ttiVhO7uW+PEBtIFU8jvRYI+Kg4OR1M6jfDUjC8/i4Otrfmh3S69Oc 2QT6LpoY9Mo9WOWQjUaoWgHyT62yXFSDnaHoE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=jmT/FEAf7Fys64Ojgj0ewSV3F2AVs/4QT7Sz1EpKb2A=; b=EpUTzuFJAlIgnj8HfIyIVf/+WJJMU7GZ5YPUpu+sHRNNREo9hiZCC6TfslwTObyR/p yDd18NTs7F6DB3ORP+mrzbdXI7UUr+R4UwcpRP06ZLWY2ip3CIhcwpIMPJ8c6lk9U82C TOnHb8mpn5YDg9vpGUWzP4vmwSfSR9MD81qcGBKtHeLJEWjPb3NpbRy972NNxX8OVpJa OGHkrJABfgEAJztiOJDc4Jvs5F7oHa+Xu4BLPkrCGHmm2sVs53UvAr3pyWej/KGoLe+8 s5ubmAiPo4Yjjh3INDYpPZDekNYoCxlfeKRncOS2Bz0TnoBRtXPkNJ9nPYVQ1pzqfl5q iwew== X-Gm-Message-State: AE9vXwM47/QB+eya8Cj+9kmdThjP42Y4xUGqFXo9UKZ3LwBR2EsNhmgQd+SHW12WobhKkMYa X-Received: by 10.98.67.193 with SMTP id l62mr9194137pfi.16.1473894518035; Wed, 14 Sep 2016 16:08:38 -0700 (PDT) Received: from hotran_localhost.amcc.com ([206.80.4.98]) by smtp.gmail.com with ESMTPSA id 7sm40393362pfk.6.2016.09.14.16.08.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Sep 2016 16:08:37 -0700 (PDT) From: Hoan Tran To: "Rafael J. Wysocki" , Viresh Kumar , pprakash@codeaurora.org, Al Stone Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, lho@apm.com, Duc Dang , Hoan Tran Subject: [PATCH] cpufreq: CPPC: Avoid overflow when calculating desired_perf Date: Wed, 14 Sep 2016 16:08:28 -0700 Message-Id: <1473894508-22270-1-git-send-email-hotran@apm.com> X-Mailer: git-send-email 1.9.1 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes overflow issue when calculating the desired_perf. Signed-off-by: Hoan Tran --- drivers/cpufreq/cppc_cpufreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index 894e465..3e0961e 100644 --- a/drivers/cpufreq/cppc_cpufreq.c +++ b/drivers/cpufreq/cppc_cpufreq.c @@ -84,7 +84,8 @@ static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, cpu = all_cpu_data[policy->cpu]; - cpu->perf_ctrls.desired_perf = target_freq * policy->max / cppc_dmi_max_khz; + cpu->perf_ctrls.desired_perf = + (u64)target_freq * policy->max / cppc_dmi_max_khz; freqs.old = policy->cur; freqs.new = target_freq;