linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Perf bug-fix] check null of sym pointer before using it
@ 2012-06-05  5:14 Shan Wei
  2012-06-11  2:07 ` Shan Wei
  2012-06-20 17:01 ` [tip:perf/core] perf annotate: Check " tip-bot for Samuel Liao
  0 siblings, 2 replies; 4+ messages in thread
From: Shan Wei @ 2012-06-05  5:14 UTC (permalink / raw)
  To: a.p.zijlstra, paulus, mingo, acme, namhyung.kim, Kernel-Maillist
  Cc: Samuel Liao

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Perf bug-fix] check null of sym pointer before using it
  2012-06-05  5:14 [Perf bug-fix] check null of sym pointer before using it Shan Wei
@ 2012-06-11  2:07 ` Shan Wei
  2012-06-11  4:45   ` Namhyung Kim
  2012-06-20 17:01 ` [tip:perf/core] perf annotate: Check " tip-bot for Samuel Liao
  1 sibling, 1 reply; 4+ messages in thread
From: Shan Wei @ 2012-06-11  2:07 UTC (permalink / raw)
  To: a.p.zijlstra, paulus, mingo, acme, namhyung.kim, Kernel-Maillist
  Cc: Samuel Liao


ping.....

It's a obvious function bug.....

Shan Wei said, at 2012/6/5 13:14:

> 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;
>  



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Perf bug-fix] check null of sym pointer before using it
  2012-06-11  2:07 ` Shan Wei
@ 2012-06-11  4:45   ` Namhyung Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2012-06-11  4:45 UTC (permalink / raw)
  To: Shan Wei
  Cc: a.p.zijlstra, paulus, mingo, acme, namhyung.kim, Kernel-Maillist,
	Samuel Liao

Hi,

On Mon, 11 Jun 2012 10:07:10 +0800, Shan Wei wrote:
> ping.....
>
> It's a obvious function bug.....
>
> Shan Wei said, at 2012/6/5 13:14:
>
>> From: Samuel Liao <samuelliao@tencent.com>
>> 
>> Sometimes, sym will be null that causing perf crash.
>> 
>> Signed-off-by: Shan Wei <davidshan@tencent.com>

Reviewed-by: Namhyung Kim <namhyung@kernel.org>

Thanks for the fix.
Namhyung


>> ---
>>  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;
>>  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:perf/core] perf annotate: Check null of sym pointer before using it
  2012-06-05  5:14 [Perf bug-fix] check null of sym pointer before using it Shan Wei
  2012-06-11  2:07 ` Shan Wei
@ 2012-06-20 17:01 ` tip-bot for Samuel Liao
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Samuel Liao @ 2012-06-20 17:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: acme, linux-kernel, paulus, mingo, hpa, mingo, davidshan,
	a.p.zijlstra, namhyung.kim, samuelliao, tglx

Commit-ID:  c0a58fb2bdf033df433cad9009c7dac4c6b872b0
Gitweb:     http://git.kernel.org/tip/c0a58fb2bdf033df433cad9009c7dac4c6b872b0
Author:     Samuel Liao <samuelliao@tencent.com>
AuthorDate: Tue, 5 Jun 2012 13:14:59 +0800
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 19 Jun 2012 14:30:26 -0300

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 <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>
---
 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 34b1c46..67a2703 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;
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-06-20 17:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-05  5:14 [Perf bug-fix] check null of sym pointer before using it Shan Wei
2012-06-11  2:07 ` Shan Wei
2012-06-11  4:45   ` Namhyung Kim
2012-06-20 17:01 ` [tip:perf/core] perf annotate: Check " tip-bot for Samuel Liao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).