mirror of https://gitee.com/openkylin/linux.git
perf parse-events: Check if the software events array slots are populated
To avoid a NULL pointer dereference when the kernel supports the new feature but the tooling still hasn't an entry for it. This happened with the recently added PERF_COUNT_SW_CGROUP_SWITCHES software event. Reported-by: Thomas Richter <tmricht@linux.ibm.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Sumanth Korikkar <sumanthk@linux.ibm.com> Link: https://lore.kernel.org/linux-perf-users/YKVESEKRjKtILhog@kernel.org/ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
fb6c79d726
commit
3b2f17ad17
|
@ -2932,9 +2932,14 @@ void print_symbol_events(const char *event_glob, unsigned type,
|
|||
}
|
||||
|
||||
for (i = 0; i < max; i++, syms++) {
|
||||
/*
|
||||
* New attr.config still not supported here, the latest
|
||||
* example was PERF_COUNT_SW_CGROUP_SWITCHES
|
||||
*/
|
||||
if (syms->symbol == NULL)
|
||||
continue;
|
||||
|
||||
if (event_glob != NULL && syms->symbol != NULL &&
|
||||
!(strglobmatch(syms->symbol, event_glob) ||
|
||||
if (event_glob != NULL && !(strglobmatch(syms->symbol, event_glob) ||
|
||||
(syms->alias && strglobmatch(syms->alias, event_glob))))
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Reference in New Issue