mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: acme@redhat.com
Cc: linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>
Subject: [PATCH 2/2] perf tools: Fix record sample overlap check for callchains
Date: Fri, 30 Mar 2012 10:38:34 -0700	[thread overview]
Message-ID: <1333129114-22117-2-git-send-email-andi@firstfloor.org> (raw)
In-Reply-To: <1333129114-22117-1-git-send-email-andi@firstfloor.org>

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))
 			return -EFAULT;
 
 		array += 1 + data->callchain->nr;
-- 
1.7.7.6


  reply	other threads:[~2012-03-30 17:39 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 ` Andi Kleen [this message]
2012-03-30 21:03   ` [PATCH 2/2] perf tools: Fix record sample overlap check for callchains David Ahern
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=1333129114-22117-2-git-send-email-andi@firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --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

Powered by JetHome