mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 21:24:08 +08:00
perf inject: The tool->read() call may pass a NULL evsel, handle it
Check first, as machines__deliver_event() may have perf_evlist__id2evsel() returning NULL. This was found while checking a report from Leo Yan that used the smatch tool to find places where a pointer is checked before use and then, later in the same function gets used without checking. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Leo Yan <leo.yan@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: https://lkml.kernel.org/n/tip-muvb8xqyh0gysgfjfq35w642@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
363bbaef63
commit
40978e9bf2
@ -224,7 +224,7 @@ static int perf_event__repipe_sample(struct perf_tool *tool,
|
|||||||
struct perf_evsel *evsel,
|
struct perf_evsel *evsel,
|
||||||
struct machine *machine)
|
struct machine *machine)
|
||||||
{
|
{
|
||||||
if (evsel->handler) {
|
if (evsel && evsel->handler) {
|
||||||
inject_handler f = evsel->handler;
|
inject_handler f = evsel->handler;
|
||||||
return f(tool, event, sample, evsel, machine);
|
return f(tool, event, sample, evsel, machine);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user