linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf probe: fix module name matching
@ 2016-08-05  9:41 Konstantin Khlebnikov
  2016-08-05 12:17 ` Masami Hiramatsu
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantin Khlebnikov @ 2016-08-05  9:41 UTC (permalink / raw)
  To: linux-kernel, Arnaldo Carvalho de Melo

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..c27b7aca4a6d 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;
 		}
 	}

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

end of thread, other threads:[~2016-08-08 19:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-05  9:41 [PATCH] perf probe: fix module name matching Konstantin Khlebnikov
2016-08-05 12:17 ` Masami Hiramatsu
2016-08-08 19:34   ` Arnaldo Carvalho de Melo

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