lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM9d7cg1zLi+NE-8QJ0hfigi33s3ts2_2onRLtYosG2CgsF=Fw@mail.gmail.com>
Date:   Mon, 21 Sep 2020 14:48:38 +0900
From:   Namhyung Kim <namhyung@...nel.org>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <a.p.zijlstra@...llo.nl>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Stephane Eranian <eranian@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Andi Kleen <ak@...ux.intel.com>,
        Ian Rogers <irogers@...gle.com>,
        John Garry <john.garry@...wei.com>,
        Kajol Jain <kjain@...ux.ibm.com>
Subject: Re: [PATCH 3/4] perf tools: Copy metric events properly when expand cgroups

On Fri, Sep 18, 2020 at 10:45 PM Jiri Olsa <jolsa@...hat.com> wrote:
>
> On Wed, Sep 16, 2020 at 03:31:28PM +0900, Namhyung Kim wrote:
>
> SNIP
>
> > +                                     free(new_expr);
> > +                                     return -ENOMEM;
> > +                             }
> > +
> > +                             memcpy(new_expr->metric_refs, old_expr->metric_refs,
> > +                                    nr * alloc_size);
> > +                     } else {
> > +                             new_expr->metric_refs = NULL;
> > +                     }
> > +
> > +                     /* calculate number of metric_events */
> > +                     for (nr = 0; old_expr->metric_events[nr]; nr++)
> > +                             continue;
> > +                     alloc_size = sizeof(*new_expr->metric_events);
> > +                     new_expr->metric_events = calloc(nr + 1, alloc_size);
> > +                     if (!new_expr->metric_events) {
> > +                             free(new_expr->metric_refs);
> > +                             free(new_expr);
> > +                             return -ENOMEM;
> > +                     }
> > +
> > +                     /* copy evsel in the same position */
> > +                     for (idx = 0; idx < nr; idx++) {
> > +                             evsel = old_expr->metric_events[idx];
> > +                             evsel = evlist__get_evsel(evlist, evsel->idx);
>
> this probably won't happen, but evlist__get_evsel can return NULL

Hmm.. yeah, it should not happen.  Anyway I'll check the result.

Thanks
Namhyung

>
> > +                             new_expr->metric_events[idx] = evsel;
> > +                     }
> > +
> > +                     list_add(&new_expr->nd, &new_me->head);
> > +             }
> > +     }
> > +     return 0;
> > +}
>
> SNIP
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ