perf/x86/intel: Fix LBR callstack issue caused by FREEZE_LBRS_ON_PMI
Hello Kan Liang,
This is a semi-automatic email about new static checker warnings.
The patch deb27519bf1f: "perf/x86/intel: Fix LBR callstack issue caused by FREEZE_LBRS_ON_PMI" from Aug 17, 2015, leads to the following Smatch complaint:
arch/x86/kernel/cpu/perf_event_intel_lbr.c:155 __intel_pmu_lbr_enable()
warn: variable dereferenced before check 'cpuc->lbr_sel' (see line 154)
arch/x86/kernel/cpu/perf_event_intel_lbr.c
153 */
154 lbr_select = cpuc->lbr_sel->config;
^^^^^^^^^^^^^^^^^^^^^New unchecked dereference.
155 if (cpuc->lbr_sel && !pmi)
^^^^^^^^^^^^^
Old code assumes it can be NULL.
156 wrmsrl(MSR_LBR_SELECT, lbr_select); 157
regards,
dan carpenter
Quoted 19 lines
Hello Kan Liang,
This is a semi-automatic email about new static checker warnings.
The patch
deb27519bf1f: "perf/x86/intel: Fix LBR callstack issue caused byFREEZE_LBRS_ON_PMI" from Aug 17, 2015, leads to the following Smatch complaint:
arch/x86/kernel/cpu/perf_event_intel_lbr.c:155__intel_pmu_lbr_enable()warn: variable dereferenced before check 'cpuc->lbr_sel' (see line154)
arch/x86/kernel/cpu/perf_event_intel_lbr.c
153 */154 lbr_select = cpuc->lbr_sel->config; ^^^^^^^^^^^^^^^^^^^^^ New unchecked dereference.
Quoted 7 lines
155 if (cpuc->lbr_sel && !pmi) ^^^^^^^^^^^^^Old code assumes it can be NULL.
156 wrmsrl(MSR_LBR_SELECT, lbr_select); 157
Thanks.
I will send out a new patch to fix it.
Regards,
Kan
Quoted 2 lines
regards,
dan carpenter