public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: acme@redhat.com, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 2/2] perf tools: Fix record sample overlap check for callchains
Date: Fri, 30 Mar 2012 15:03:53 -0600	[thread overview]
Message-ID: <4F761FB9.4070107@gmail.com> (raw)
In-Reply-To: <1333129114-22117-2-git-send-email-andi@firstfloor.org>

On 3/30/12 11:38 AM, Andi Kleen wrote:
> From: Andi Kleen<ak@linux.intel.com>
>
> perf record checks for buffer overflow, but checked for the wrong
> size for callchains.  callchains are 8 bytes each, not 1.
>
> Signed-off-by: Andi Kleen<ak@linux.intel.com>
> ---
>   tools/perf/util/evsel.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index f421f7c..90c0756 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c
> @@ -550,7 +550,7 @@ int perf_event__parse_sample(const union perf_event *event, u64 type,
>
>   		data->callchain = (struct ip_callchain *)array;
>
> -		if (sample_overlap(event, array, data->callchain->nr))
> +		if (sample_overlap(event, array, (1 + data->callchain->nr) * 8))

sizeof(u64) rather than the magic 8?

David

>   			return -EFAULT;
>
>   		array += 1 + data->callchain->nr;


  reply	other threads:[~2012-03-30 21:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-30 17:38 [PATCH 1/2] perf tools: fix build for rbtree.c change Andi Kleen
2012-03-30 17:38 ` [PATCH 2/2] perf tools: Fix record sample overlap check for callchains Andi Kleen
2012-03-30 21:03   ` David Ahern [this message]
2012-03-30 17:47 ` [PATCH 1/2] perf tools: fix build for rbtree.c change Josh Boyer
2012-03-30 22:00   ` Arnaldo Carvalho de Melo
2012-03-30 20:58 ` Arnaldo Carvalho de Melo

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=4F761FB9.4070107@gmail.com \
    --to=dsahern@gmail.com \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox