lkml.org 
[lkml]   [2012]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[Perf bug-fix] check null of sym pointer before using it
From: Samuel Liao <samuelliao@tencent.com>

Sometimes, sym will be null that causing perf crash.

Signed-off-by: Shan Wei <davidshan@tencent.com>
---
tools/perf/ui/browsers/annotate.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c
index 4deea6a..50873a8 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;

--
1.7.1


\
 
 \ /
  Last update: 2012-06-05 08:01    [W:1.469 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site