]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
perf probe: Fix module name matching
authorKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Fri, 5 Aug 2016 12:22:36 +0000 (15:22 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 9 Aug 2016 13:48:09 +0000 (10:48 -0300)
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>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Link: http://lkml.kernel.org/r/147039975648.715620.12985971832789032159.stgit@buzz
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/probe-event.c

index d5ccb656fd81fc6b05bc48285629c4d4286bd1d2..1201f73ca723a67d8f6bbda6eef21952a3984b00 100644 (file)
@@ -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;
                }
        }