diff options
author | Ian Rogers <irogers@google.com> | 2023-07-27 17:12:10 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-08-03 17:01:24 -0300 |
commit | c76a1444c00ea6900a5e7d10065d6e93b0e104f9 (patch) | |
tree | a189fb7b936bbbc1e446fd75043e5f1c80bcabaf /tools/perf/util/parse-events.c | |
parent | c7e97f215a4ad634b746804679f5937d25f77e29 (diff) |
perf parse-event: Avoid BPF test SEGV
loc is passed as NULL in tools/perf/tests/bpf.c do_test, meaning
errors trigger a SEGV when trying to access. Add the missing NULL
check.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Wang ShaoBo <bobo.shaobowang@huawei.com>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20230728001212.457900-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r-- | tools/perf/util/parse-events.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index acddb2542b1a..e17e96b4f798 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -757,7 +757,7 @@ int parse_events_load_bpf_obj(struct parse_events_state *parse_state, return 0; errout: - parse_events_error__handle(parse_state->error, param.loc->first_column, + parse_events_error__handle(parse_state->error, param.loc ? param.loc->first_column : 0, strdup(errbuf), strdup("(add -v to see detail)")); return err; } |