aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/browsers/annotate.c
diff options
context:
space:
mode:
authorSamuel Liao <[email protected]>2012-06-05 05:14:59 +0000
committerArnaldo Carvalho de Melo <[email protected]>2012-06-19 17:30:26 +0000
commitc0a58fb2bdf033df433cad9009c7dac4c6b872b0 (patch)
treed4c65704aae722151a0d85cca74d1e30577c99e4 /tools/perf/ui/browsers/annotate.c
parentperf evsel: Make some methods private (diff)
downloadkernel-c0a58fb2bdf033df433cad9009c7dac4c6b872b0.tar.gz
kernel-c0a58fb2bdf033df433cad9009c7dac4c6b872b0.zip
perf annotate: Check null of sym pointer before using it
Sym may be NULL, and that will cause perf to crash. Signed-off-by: Shan Wei <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/ui/browsers/annotate.c')
-rw-r--r--tools/perf/ui/browsers/annotate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 34b1c46eaf42..67a2703e666a 100644
--- a/tools/perf/ui/browsers/annotate.c
+++ b/tools/perf/ui/browsers/annotate.c
@@ -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,
@@ -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;