lkml.org 
[lkml]   [2020]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/4] perf tools: Mark ksymbol dsos with kernel type
On Mon, Feb 10, 2020 at 12:17:59PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Mon, Feb 10, 2020 at 03:32:16PM +0100, Jiri Olsa escreveu:
> > We add ksymbol map into machine->kmaps, so it needs to be
> > created as 'struct kmap', which is dependent on its dso
> > having kernel type.
> >
> > Reported-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> > Tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/perf/util/machine.c | 10 ++++++++--
> > 1 file changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> > index e3e5490f6de5..0a43dc83d7b2 100644
> > --- a/tools/perf/util/machine.c
> > +++ b/tools/perf/util/machine.c
> > @@ -727,8 +727,14 @@ static int machine__process_ksymbol_register(struct machine *machine,
> > struct map *map = maps__find(&machine->kmaps, event->ksymbol.addr);
> >
> > if (!map) {
> > - map = dso__new_map(event->ksymbol.name);
> > - if (!map)
> > + struct dso *dso = dso__new(event->ksymbol.name);
> > +
> > + if (dso) {
> > + dso->kernel = DSO_TYPE_KERNEL;
> > + map = map__new2(0, dso);
> > + }
> > +
> > + if (!dso || !map)
>
> We leak dso if map creation fails?

yep :-\ will post v2

thanks,
jirka

>
>
> - Arnaldo
>
> > return -ENOMEM;
> >
> > map->start = event->ksymbol.addr;
> > --
> > 2.24.1
> >
>
> --
>
> - Arnaldo
>

\
 
 \ /
  Last update: 2020-02-10 16:27    [W:0.068 / U:2.876 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site