Commit cb3f3378 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov Committed by Arnaldo Carvalho de Melo

perf probe: Fix module name matching

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: default avatarKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Link: http://lkml.kernel.org/r/147039975648.715620.12985971832789032159.stgit@buzzSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 8e34189b
...@@ -170,8 +170,10 @@ static struct map *kernel_get_module_map(const char *module) ...@@ -170,8 +170,10 @@ static struct map *kernel_get_module_map(const char *module)
module = "kernel"; module = "kernel";
for (pos = maps__first(maps); pos; pos = map__next(pos)) { for (pos = maps__first(maps); pos; pos = map__next(pos)) {
/* short_name is "[module]" */
if (strncmp(pos->dso->short_name + 1, 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; return pos;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment