lkml.org 
[lkml]   [2016]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf probe: fix module name matching
Em Fri, Aug 05, 2016 at 09:17:29PM +0900, Masami Hiramatsu escreveu:
> On Fri, 05 Aug 2016 12:41:03 +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.
>
> Right, just one comment on this patch.
>
> >
> > 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) {
>
> Here, please use '\0' instead of 0, because "module" should points a null
> terminated string.

I can do this myself, with that, can I have your Acked-by?

> Thanks,
>
> > return pos;
> > }
> > }
> >
>
>
> --
> Masami Hiramatsu <mhiramat@kernel.org>

\
 
 \ /
  Last update: 2016-08-08 22:21    [W:0.037 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site