All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Arun Sharma <asharma@fb.com>
Cc: Sam Liao <phyomh@gmail.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] [perf] Add inverted call graph report support.
Date: Thu, 09 Jun 2011 14:10:25 -0600	[thread overview]
Message-ID: <4DF128B1.4010409@gmail.com> (raw)
In-Reply-To: <20110609193300.GA16858@dev1756.snc6.facebook.com>



On 06/09/2011 01:33 PM, Arun Sharma wrote:
> On Thu, Jun 09, 2011 at 02:44:19PM +0800, Sam Liao wrote:
>> --- a/tools/perf/util/session.c
>> +++ b/tools/perf/util/session.c
>> @@ -247,9 +247,14 @@ int perf_session__resolve_callchain(struct
>> perf_session *self,
>>  	callchain_cursor_reset(&self->callchain_cursor);
>>
>>  	for (i = 0; i < chain->nr; i++) {
>> -		u64 ip = chain->ips[i];
>> +		u64 ip;
>>  		struct addr_location al;
>>
>> +		if (callchain_param.order == ORDER_CALLEE)
>> +			ip = chain->ips[i];
>> +		else
>> +			ip = chain->ips[chain->nr - i - 1];
> 
> This can dereference a bad pointer if chain->nr == 0.

Should not enter the loop if chain->nr is 0 (See for arg).

David


> 
>  -Arun
> --
> To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-06-09 20:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09  6:44 [PATCH] [perf] Add inverted call graph report support Sam Liao
2011-06-09 19:33 ` Arun Sharma
2011-06-09 20:10   ` David Ahern [this message]
2011-06-09 20:13     ` Arun Sharma
2011-06-14 22:15   ` Arun Sharma
2011-06-15  6:01     ` Sam Liao
2011-06-15  8:15       ` Ingo Molnar
2011-06-15 22:24         ` Frederic Weisbecker
2011-06-10 20:42 ` Arnaldo Carvalho de Melo
2011-06-15 19:40   ` Frederic Weisbecker
2011-06-15 22:15 ` Frederic Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DF128B1.4010409@gmail.com \
    --to=dsahern@gmail.com \
    --cc=asharma@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=phyomh@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.