linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf: check if address is in range
@ 2012-01-12 20:39 Sorin Dumitru
  2012-01-12 20:49 ` Daniel Baluta
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Sorin Dumitru @ 2012-01-12 20:39 UTC (permalink / raw)
  To: linux-kernel, a.p.zijlstra, acme; +Cc: Sorin Dumitru

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..4ddc55f 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


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

end of thread, other threads:[~2012-01-29 18:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-12 20:39 [PATCH] perf: check if address is in range Sorin Dumitru
2012-01-12 20:49 ` Daniel Baluta
2012-01-12 20:59   ` Sorin Dumitru
2012-01-12 20:55 ` Sorin Dumitru
2012-01-13 12:25 ` Arnaldo Carvalho de Melo
2012-01-13 16:35   ` Sorin Dumitru
2012-01-29 18:04     ` Sorin Dumitru

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).