public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Geyslan G. Bem" <geyslan@gmail.com>
To: kernel-br@googlegroups.com
Cc: "Geyslan G. Bem" <geyslan@gmail.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	cpufreq@vger.kernel.org (open list:CPU FREQUENCY DRI...),
	linux-pm@vger.kernel.org (open list:CPU FREQUENCY DRI...),
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] cpufreq: intel_pstate: fix possible integer overflow
Date: Sun, 20 Oct 2013 00:31:16 -0300	[thread overview]
Message-ID: <1382239876-12688-1-git-send-email-geyslan@gmail.com> (raw)

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


             reply	other threads:[~2013-10-20  3:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-20  3:31 Geyslan G. Bem [this message]
2013-10-21 15:56 ` [PATCH] cpufreq: intel_pstate: fix possible integer overflow 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1382239876-12688-1-git-send-email-geyslan@gmail.com \
    --to=geyslan@gmail.com \
    --cc=cpufreq@vger.kernel.org \
    --cc=kernel-br@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox