Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753067Ab2FKCGD (ORCPT ); Sun, 10 Jun 2012 22:06:03 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:49928 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751977Ab2FKCGA (ORCPT ); Sun, 10 Jun 2012 22:06:00 -0400 Message-ID: <4FD552CE.5020303@gmail.com> Date: Mon, 11 Jun 2012 10:07:10 +0800 From: Shan Wei User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: a.p.zijlstra@chello.nl, paulus@samba.org, mingo@redhat.com, acme@ghostprotocols.net, namhyung.kim@lge.com, Kernel-Maillist CC: Samuel Liao Subject: Re: [Perf bug-fix] check null of sym pointer before using it References: <4FCD95D3.90209@gmail.com> In-Reply-To: <4FCD95D3.90209@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1306 Lines: 45 ping..... It's a obvious function bug..... Shan Wei said, at 2012/6/5 13:14: > From: Samuel Liao > > Sometimes, sym will be null that causing perf crash. > > Signed-off-by: Shan Wei > --- > 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; > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/