Skip to content

Commit

Permalink
perf annotate: Check null of sym pointer before using it
Browse files Browse the repository at this point in the history
Sym may be NULL, and that will cause perf to crash.

Signed-off-by: Shan 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.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Samuel Liao authored and Arnaldo Carvalho de Melo committed Jun 19, 2012
1 parent dd4f522 commit c0a58fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/perf/ui/browsers/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
{
struct disasm_line *pos, *n;
struct annotation *notes;
const size_t size = symbol__size(sym);
size_t size;
struct map_symbol ms = {
.map = map,
.sym = sym,
Expand All @@ -834,6 +834,8 @@ int symbol__tui_annotate(struct symbol *sym, struct map *map, int evidx,
if (sym == NULL)
return -1;

size = symbol__size(sym);

if (map->dso->annotate_warned)
return -1;

Expand Down

0 comments on commit c0a58fb

Please sign in to comment.