]> Git Repo - linux.git/commitdiff
perf/x86/intel: Fix constraint access
authorPeter Zijlstra <[email protected]>
Thu, 10 Sep 2015 09:58:27 +0000 (11:58 +0200)
committerIngo Molnar <[email protected]>
Sun, 13 Sep 2015 07:37:10 +0000 (09:37 +0200)
Sasha reported that we can get here with .idx==-1, and
cpuc->event_constraints unallocated.

Suggested-by: Stephane Eranian <[email protected]>
Reported-by: Sasha Levin <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: <[email protected]>
Fixes: b371b5943178 ("perf/x86: Fix event/group validation")
Signed-off-by: Ingo Molnar <[email protected]>
arch/x86/kernel/cpu/perf_event_intel.c

index 3f124d553c5aaa2fef8baf4f03f609a65bb5f191..f41e4dc781190a7fdc00494904be803aabfdb6b6 100644 (file)
@@ -2316,9 +2316,12 @@ static struct event_constraint *
 intel_get_event_constraints(struct cpu_hw_events *cpuc, int idx,
                            struct perf_event *event)
 {
-       struct event_constraint *c1 = cpuc->event_constraint[idx];
+       struct event_constraint *c1 = NULL;
        struct event_constraint *c2;
 
+       if (idx >= 0) /* fake does < 0 */
+               c1 = cpuc->event_constraint[idx];
+
        /*
         * first time only
         * - static constraint: no change across incremental scheduling calls
This page took 0.065518 seconds and 4 git commands to generate.