Commit c0a58fb2 authored by Samuel Liao's avatar Samuel Liao Committed by Arnaldo Carvalho de Melo

perf annotate: Check null of sym pointer before using it

Sym may be NULL, and that will cause perf to crash.
Signed-off-by: default avatarShan Wei <davidshan@tencent.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/4FCD95D3.90209@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent dd4f5223
...@@ -814,7 +814,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, ...@@ -814,7 +814,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
{ {
struct disasm_line *pos, *n; struct disasm_line *pos, *n;
struct annotation *notes; struct annotation *notes;
const size_t size = symbol__size(sym); size_t size;
struct map_symbol ms = { struct map_symbol ms = {
.map = map, .map = map,
.sym = sym, .sym = sym,
...@@ -834,6 +834,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx, ...@@ -834,6 +834,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
if (sym == NULL) if (sym == NULL)
return -1; return -1;
size = symbol__size(sym);
if (map->dso->annotate_warned) if (map->dso->annotate_warned)
return -1; return -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment