Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457069

[PATCH v2] perf probe: fix module name matching

From Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Newsgroups linux.kernel
Subject [PATCH v2] perf probe: fix module name matching
Date 2016-08-05 14:30 +0200
Message-ID <s2Mqd-7rU-13@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


If module is "module" then dso->short_name is "[module]".
Substring comparing is't enough: "raid10" matches to "[raid1]".
This patch also checks terminating zero in module name.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 tools/perf/util/probe-event.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 953dc1ab2ed7..dd2d60ef05d3 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -170,8 +170,10 @@ static struct map *kernel_get_module_map(const char *module)
 		module = "kernel";
 
 	for (pos = maps__first(maps); pos; pos = map__next(pos)) {
+		/* short_name is "[module]" */
 		if (strncmp(pos->dso->short_name + 1, module,
-			    pos->dso->short_name_len - 2) == 0) {
+			    pos->dso->short_name_len - 2) == 0 &&
+		    module[pos->dso->short_name_len - 2] == '\0') {
 			return pos;
 		}
 	}

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v2] perf probe: fix module name matching Konstantin Khlebnikov <khlebnikov@yandex-team.ru> - 2016-08-05 14:30 +0200
  Re: [PATCH v2] perf probe: fix module name matching Masami Hiramatsu <mhiramat@kernel.org> - 2016-08-06 22:40 +0200
    Re: [PATCH v2] perf probe: fix module name matching Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-08-08 21:40 +0200
  [tip:perf/urgent] perf probe: Fix module name matching tip-bot for Konstantin Khlebnikov <tipbot@zytor.com> - 2016-08-09 21:20 +0200

csiph-web