|
@@ -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;
|