summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorBaruch Siach <baruch@tkos.co.il>2013-07-17 12:46:53 +0300
committerJohn Stultz <john.stultz@linaro.org>2013-07-22 16:24:22 -0700
commit53c035204253efe373d9ff166fae6147e8c693b6 (patch)
tree3a12ce29c5321a4b390550cbf344c46c5cee9746 /kernel
parentb0ec636c93ddd77235bf0f023a8a95d78cb6cafe (diff)
downloadlinux-53c035204253efe373d9ff166fae6147e8c693b6.tar.gz
linux-53c035204253efe373d9ff166fae6147e8c693b6.tar.bz2
linux-53c035204253efe373d9ff166fae6147e8c693b6.zip
sched_clock: Fix integer overflow
The expression '(1 << 32)' happens to evaluate as 0 on ARM, but it evaluates as 1 on xtensa and x86_64. This zeros sched_clock_mask, and breaks sched_clock(). Set the type of 1 to 'unsigned long long' to get the value we need. Reported-by: Max Filippov <jcmvbkbc@gmail.com> Tested-by: Max Filippov <jcmvbkbc@gmail.com> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/sched_clock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
index a326f27d7f09..0b479a6a22bb 100644
--- a/kernel/time/sched_clock.c
+++ b/kernel/time/sched_clock.c
@@ -121,7 +121,7 @@ void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
BUG_ON(bits > 32);
WARN_ON(!irqs_disabled());
read_sched_clock = read;
- sched_clock_mask = (1 << bits) - 1;
+ sched_clock_mask = (1ULL << bits) - 1;
cd.rate = rate;
/* calculate the mult/shift to convert counter ticks to ns. */