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


Groups > linux.kernel > #1457069 > unrolled thread

[PATCH v2] perf probe: fix module name matching

Started byKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
First post2016-08-05 14:30 +0200
Last post2016-08-09 21:20 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [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

#1457069 — [PATCH v2] perf probe: fix module name matching

FromKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Date2016-08-05 14:30 +0200
Subject[PATCH v2] perf probe: fix module name matching
Message-ID<s2Mqd-7rU-13@gated-at.bofh.it>
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;
 		}
 	}

[toc] | [next] | [standalone]


#1457338

FromMasami Hiramatsu <mhiramat@kernel.org>
Date2016-08-06 22:40 +0200
Message-ID<s3gxX-29J-9@gated-at.bofh.it>
In reply to#1457069
On Fri, 05 Aug 2016 15:22:36 +0300
Konstantin Khlebnikov <khlebnikov@yandex-team.ru> wrote:

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

Looks good to me :)

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thanks!

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


-- 
Masami Hiramatsu <mhiramat@kernel.org>

[toc] | [prev] | [next] | [standalone]


#1458139

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2016-08-08 21:40 +0200
Message-ID<s3Yz0-5Ay-37@gated-at.bofh.it>
In reply to#1457338
Em Sat, Aug 06, 2016 at 07:30:45PM +0900, Masami Hiramatsu escreveu:
> On Fri, 05 Aug 2016 15:22:36 +0300
> Konstantin Khlebnikov <khlebnikov@yandex-team.ru> wrote:
> 
> > 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>
> 
> Looks good to me :)
> 
> Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Ok, nevermind that other message, I hadn't seen this one, thanks!
 
> Thanks!
> 
> > ---
> >  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;
> >  		}
> >  	}
> > 
> 
> 
> -- 
> Masami Hiramatsu <mhiramat@kernel.org>

[toc] | [prev] | [next] | [standalone]


#1459071 — [tip:perf/urgent] perf probe: Fix module name matching

Fromtip-bot for Konstantin Khlebnikov <tipbot@zytor.com>
Date2016-08-09 21:20 +0200
Subject[tip:perf/urgent] perf probe: Fix module name matching
Message-ID<s4kJb-3eT-1@gated-at.bofh.it>
In reply to#1457069
Commit-ID:  cb3f3378cd09aa3fe975b4ad5ee0229dc76315bb
Gitweb:     http://git.kernel.org/tip/cb3f3378cd09aa3fe975b4ad5ee0229dc76315bb
Author:     Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
AuthorDate: Fri, 5 Aug 2016 15:22:36 +0300
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 9 Aug 2016 10:48:09 -0300

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: 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 | 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 d5ccb65..1201f73 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;
 		}
 	}

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web