projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6d6daa2
)
perf/x86/intel: Use ULL constant to prevent undefined shift behaviour
author
Colin King
<
[email protected]
>
Wed, 11 Jan 2017 11:43:10 +0000
(11:43 +0000)
committer
Thomas Gleixner
<
[email protected]
>
Wed, 11 Jan 2017 15:43:30 +0000
(16:43 +0100)
When x86_pmu.num_counters is 32 the shift of the integer constant 1 is
exceeding 32bit and therefor undefined behaviour.
Fix this by shifting 1ULL instead of 1.
Reported-by: CoverityScan CID#1192105 ("Bad bit shift operation")
Signed-off-by: Colin Ian King <
[email protected]
>
Cc: Andi Kleen <
[email protected]
>
Cc: Peter Zijlstra <
[email protected]
>
Cc: Kan Liang <
[email protected]
>
Cc: Stephane Eranian <
[email protected]
>
Cc: Alexander Shishkin <
[email protected]
>
Link:
http://lkml.kernel.org/r/
[email protected]
Signed-off-by: Thomas Gleixner <
[email protected]
>
arch/x86/events/intel/core.c
patch
|
blob
|
history
diff --git
a/arch/x86/events/intel/core.c
b/arch/x86/events/intel/core.c
index 86138267b68a77753737ffd4c4be2ece6a24cc84..d611cab214a6050555eb4c5f6f5638ca46b4659e 100644
(file)
--- a/
arch/x86/events/intel/core.c
+++ b/
arch/x86/events/intel/core.c
@@
-3987,7
+3987,7
@@
__init int intel_pmu_init(void)
x86_pmu.num_counters, INTEL_PMC_MAX_GENERIC);
x86_pmu.num_counters = INTEL_PMC_MAX_GENERIC;
}
- x86_pmu.intel_ctrl = (1 << x86_pmu.num_counters) - 1;
+ x86_pmu.intel_ctrl = (1
ULL
<< x86_pmu.num_counters) - 1;
if (x86_pmu.num_counters_fixed > INTEL_PMC_MAX_FIXED) {
WARN(1, KERN_ERR "hw perf events fixed %d > max(%d), clipping!",