All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cpufreq: intel_pstate: fix possible integer overflow
@ 2013-10-20  3:31 ` Geyslan G. Bem
  0 siblings, 0 replies; 7+ messages in thread
From: Geyslan G. Bem @ 2013-10-20  3:31 UTC (permalink / raw)
  To: kernel-br
  Cc: Geyslan G. Bem, Rafael J. Wysocki, Viresh Kumar,
	open list:CPU FREQUENCY DRI..., open list:CPU FREQUENCY DRI...,
	open list

The expression 'pstate << 8' is evaluated using 32-bit arithmetic while
'val' expects an expression of type u64.

Signed-off-by: Geyslan G. Bem <geyslan@gmail.com>
---
 drivers/cpufreq/intel_pstate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
index badf620..43446b5 100644
--- a/drivers/cpufreq/intel_pstate.c
+++ b/drivers/cpufreq/intel_pstate.c
@@ -395,7 +395,7 @@ static void intel_pstate_set_pstate(struct cpudata *cpu, int pstate)
 	trace_cpu_frequency(pstate * 100000, cpu->cpu);
 
 	cpu->pstate.current_pstate = pstate;
-	val = pstate << 8;
+	val = (u64)pstate << 8;
 	if (limits.no_turbo)
 		val |= (u64)1 << 32;
 
-- 
1.8.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-10-22 10:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-20  3:31 [PATCH] cpufreq: intel_pstate: fix possible integer overflow Geyslan G. Bem
2013-10-20  3:31 ` Geyslan G. Bem
2013-10-21 15:56 ` Dirk Brandewie
2013-10-21 22:47   ` Rafael J. Wysocki
2013-10-21 22:43     ` Dirk Brandewie
2013-10-21 23:06       ` Rafael J. Wysocki
     [not found]         ` <CANOOhLRCC360exKKePsJGxYqx3ULZf1Ac0y16hsnPQNP69OHwA@mail.gmail.com>
2013-10-22 10:25           ` Geyslan Gregório Bem

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.