From: Sorin Dumitru <dumitru.sorin87@gmail.com>
To: linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl,
acme@ghostprotocols.net
Cc: Sorin Dumitru <dumitru.sorin87@gmail.com>
Subject: [PATCH] perf: check if address is in range
Date: Thu, 12 Jan 2012 22:55:49 +0200 [thread overview]
Message-ID: <1326401749-25586-1-git-send-email-dumitru.sorin87@gmail.com> (raw)
In-Reply-To: <1326400778-24131-1-git-send-email-dumitru.sorin87@gmail.com>
When addr isn't in the [sym->start,sym->end] range offset
will be a very big value, giving us a segfault when we do:
h->addr[offset]++
Fix this by checking that addr is in the correct range.
Signed-off-by: Sorin Dumitru <dumitru.sorin87@gmail.com>
---
tools/perf/util/annotate.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 011ed26..59aa456 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -64,7 +64,7 @@ int symbol__inc_addr_samples(struct symbol *sym, struct map *map,
pr_debug3("%s: addr=%#" PRIx64 "\n", __func__, map->unmap_ip(map, addr));
- if (addr >= sym->end)
+ if (addr < sym->start || addr >= sym->end)
return 0;
offset = addr - sym->start;
--
1.7.8.3
next prev parent reply other threads:[~2012-01-12 20:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-12 20:39 Sorin Dumitru
2012-01-12 20:49 ` Daniel Baluta
2012-01-12 20:59 ` Sorin Dumitru
2012-01-12 20:55 ` Sorin Dumitru [this message]
2012-01-13 12:25 ` Arnaldo Carvalho de Melo
2012-01-13 16:35 ` Sorin Dumitru
2012-01-29 18:04 ` Sorin Dumitru
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=1326401749-25586-1-git-send-email-dumitru.sorin87@gmail.com \
--to=dumitru.sorin87@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--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
all inboxes | Powered by JetHome®