From: Ian Rogers Date: Tue, 21 Apr 2020 00:43:29 +0000 (-0700) Subject: perf script: Avoid NULL dereference on symbol X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=1e76b171b71565b96117c2670c64ba54e36a9c2e;p=linux.git perf script: Avoid NULL dereference on symbol al->sym may be NULL given current if conditions and may cause a segv. Fixes: d2bedb7863e9 ("perf script: Allow --symbol to accept hexadecimal addresses") Signed-off-by: Ian Rogers Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lore.kernel.org/lkml/20200421004329.43109-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index dc0e11214ae1a..f581550a3015d 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -626,7 +626,7 @@ int machine__resolve(struct machine *machine, struct addr_location *al, ret = strlist__has_entry(symbol_conf.sym_list, al->sym->name); } - if (!(ret && al->sym)) { + if (!ret && al->sym) { snprintf(al_addr_str, sz, "0x%"PRIx64, al->map->unmap_ip(al->map, al->sym->start)); ret = strlist__has_entry(symbol_conf.sym_list,