summaryrefslogtreecommitdiffstats
path: root/arch/x86/events/intel/cstate.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-05-14 11:22:59 +0200
committerIngo Molnar <mingo@kernel.org>2018-05-14 11:22:59 +0200
commit4b96583869c4d990b779eca72976063970d41b8d (patch)
treef2fdb7760a06f6445f33fdee3ec512fbdb46fcb4 /arch/x86/events/intel/cstate.c
parentdt-bindings/gic-v3: Add documentation for MBI support (diff)
parentLinux 4.17-rc5 (diff)
downloadlinux-4b96583869c4d990b779eca72976063970d41b8d.tar.xz
linux-4b96583869c4d990b779eca72976063970d41b8d.zip
Merge tag 'v4.17-rc5' into irq/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/events/intel/cstate.c')
-rw-r--r--arch/x86/events/intel/cstate.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/events/intel/cstate.c b/arch/x86/events/intel/cstate.c
index 9aca448bb8e6..9f8084f18d58 100644
--- a/arch/x86/events/intel/cstate.c
+++ b/arch/x86/events/intel/cstate.c
@@ -92,6 +92,7 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/perf_event.h>
+#include <linux/nospec.h>
#include <asm/cpu_device_id.h>
#include <asm/intel-family.h>
#include "../perf_event.h"
@@ -302,6 +303,7 @@ static int cstate_pmu_event_init(struct perf_event *event)
} else if (event->pmu == &cstate_pkg_pmu) {
if (cfg >= PERF_CSTATE_PKG_EVENT_MAX)
return -EINVAL;
+ cfg = array_index_nospec((unsigned long)cfg, PERF_CSTATE_PKG_EVENT_MAX);
if (!pkg_msr[cfg].attr)
return -EINVAL;
event->hw.event_base = pkg_msr[cfg].msr;