aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/events/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index b1be0ac51ce0..45b2b1c93d04 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -27,6 +27,7 @@
27#include <linux/cpu.h> 27#include <linux/cpu.h>
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29#include <linux/device.h> 29#include <linux/device.h>
30#include <linux/nospec.h>
30 31
31#include <asm/apic.h> 32#include <asm/apic.h>
32#include <asm/stacktrace.h> 33#include <asm/stacktrace.h>
@@ -424,6 +425,8 @@ int x86_setup_perfctr(struct perf_event *event)
424 if (attr->config >= x86_pmu.max_events) 425 if (attr->config >= x86_pmu.max_events)
425 return -EINVAL; 426 return -EINVAL;
426 427
428 attr->config = array_index_nospec((unsigned long)attr->config, x86_pmu.max_events);
429
427 /* 430 /*
428 * The generic map: 431 * The generic map:
429 */ 432 */