perf evsel: Make perf_evsel__name() accept a NULL argument
authorArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 17 Jun 2019 17:32:53 +0000 (14:32 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jul 2019 05:28:26 +0000 (07:28 +0200)
commitb5b7d3a8d33af2e98159c78f81e9330395b58c9f
treecbfe4c44f6b66390c5db070ffa3a9ca4482518f2
parent11a6dd0034b6fc3a55ffe1382262797f4aec9f5d
perf evsel: Make perf_evsel__name() accept a NULL argument

[ Upstream commit fdbdd7e8580eac9bdafa532746c865644d125e34 ]

In which case it simply returns "unknown", like when it can't figure out
the evsel->name value.

This makes this code more robust and fixes a problem in 'perf trace'
where a NULL evsel was being passed to a routine that only used the
evsel for printing its name when a invalid syscall id was passed.

Reported-by: Leo Yan <leo.yan@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-f30ztaasku3z935cn3ak3h53@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/perf/util/evsel.c