diff options
-rw-r--r-- | arch/x86/events/core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 61d9e8a72637..02e547f9ca3f 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -26,6 +26,7 @@ #include <linux/cpu.h> #include <linux/bitops.h> #include <linux/device.h> +#include <linux/nospec.h> #include <asm/apic.h> #include <asm/stacktrace.h> @@ -423,6 +424,8 @@ int x86_setup_perfctr(struct perf_event *event) if (attr->config >= x86_pmu.max_events) return -EINVAL; + attr->config = array_index_nospec((unsigned long)attr->config, x86_pmu.max_events); + /* * The generic map: */ |