From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933632AbcINXIz (ORCPT ); Wed, 14 Sep 2016 19:08:55 -0400 Received: from mail-pf0-f180.google.com ([209.85.192.180]:36258 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765343AbcINXIj (ORCPT ); Wed, 14 Sep 2016 19:08:39 -0400 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 1.9.1