cpufreq: CPPC: Avoid overflow when calculating desired_perf
PATCH 1/1 cpufreq: CPPC: Avoid overflow when calculating desired_perf
This patch fixes overflow issue when calculating the desired_perf.
--- drivers/cpufreq/cppc_cpufreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/cpufreq/cppc_cpufreq.c +2 -1
@@ -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;
Signature · 1 line
1.9.1
Quoted 12 lines · Hoan Tran
This patch fixes overflow issue when calculating the
desired_perf.Signed-off-by Hoan Tran <[email protected]>--- drivers/cpufreq/cppc_cpufreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/cpufreq/cppc_cpufreq.c +0
-0
drivers/cpufreq/cppc_cpufreq.c static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, · line 90
Quoted 8 lines
drivers/cpufreq/cppc_cpufreq.c +2
-1@@ -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;
That's on top of the CPPC material in linux-next I gather?
Which commit does it fix?
Thanks,
Rafael
Hi Rafael,
Quoted 16 lines · Rafael J. Wysocki
Quoted 15 lines · Hoan Tran
This patch fixes overflow issue when calculating the
desired_perf.Signed-off-by Hoan Tran <[email protected]>--- drivers/cpufreq/cppc_cpufreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/cpufreq/cppc_cpufreq.c +0
-0@@ -84,7 +84,8 @@ static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, cpu = all_cpu_data[policy->cpu];
Quoted 7 lines
drivers/cpufreq/cppc_cpufreq.c static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, · line 90
Quoted 5 lines
drivers/cpufreq/cppc_cpufreq.c +2
-1- 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;That's on top of the CPPC material in linux-next I gather?
Yes, it's on TOP of linux-next.
Quoted 2 lines
Which commit does it fix?
This is a fix for ad38677df44b67e0f5b6c4d31e9c2734abde8ed9 (cpufreq:
CPPC: Force reporting values in KHz to fix user space interface)
http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/drivers/cpufreq/cppc_cpufreq.c?id=ad38677df44b67e0f5b6c4d31e9c2734abde8ed9
Thanks
Hoan
Quoted 4 lines
Thanks,
Rafael
Quoted 30 lines · Hoan Tran
Hi Rafael,
Quoted 16 lines · Rafael J. Wysocki
Quoted 15 lines · Hoan Tran
This patch fixes overflow issue when calculating the
desired_perf.Signed-off-by Hoan Tran <[email protected]>--- drivers/cpufreq/cppc_cpufreq.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/cpufreq/cppc_cpufreq.c +0
-0@@ -84,7 +84,8 @@ static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, cpu = all_cpu_data[policy->cpu];Quoted 7 lines
drivers/cpufreq/cppc_cpufreq.c static int cppc_cpufreq_set_target(struct cpufreq_policy *policy, · line 90
Quoted 5 lines
drivers/cpufreq/cppc_cpufreq.c +2
-1- 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;That's on top of the CPPC material in linux-next I gather?
Yes, it's on TOP of linux-next.
Quoted 1 line
Quoted 13 lines
Quoted 1 line
Which commit does it fix?
This is a fix for
ad38677df44b67e0f5b6c4d31e9c2734abde8ed9(cpufreq:
CPPC: Force reporting values in KHz to fix user space interface)
http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/drivers/cpufreq/cppc_cpufreq.c?id=ad38677df44b67e0f5b6c4d31e9c2734abde8ed9Thanks
HoanQuoted 4 lines
Thanks,
Rafael
Nice catch, Hoan. Thanks!
Signature · 8 lines
ciao, al ----------------------------------- Al Stone Software Engineer Red Hat, Inc. [email protected] -----------------------------------