[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z1s1gB6FQZg3ZZqL@x1>
Date: Thu, 12 Dec 2024 16:12:00 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: James Clark <james.clark@...aro.org>, Levi Yun <yeoreum.yun@....com>,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
nd@....com, namhyung@...nel.org, mark.rutland@....com,
james.clark2@....com
Subject: Re: [PATCH 1/1] perf/util: initialize is_test value in
expr__ctx_new()
On Wed, Nov 13, 2024 at 08:57:08AM -0800, Ian Rogers wrote:
> On Wed, Nov 13, 2024 at 8:13 AM James Clark <james.clark@...aro.org> wrote:
> > On 08/11/2024 2:34 pm, Levi Yun wrote:
> > > when expr_parse_ctx is allocated by expr_ctx_new(),
> > > expr_scanner_ctx->is_test isn't initialize, so it has garbage value.
> > > this can affects the result of expr__parse() return when it parses
> > > non-exist event literal according to garbage value.
> > >
> > > use calloc instead of malloc in expr_ctx_new() to fix this.
> > >
> > > Fixes: 3340a08354ac ("perf pmu-events: Fix testing with JEVENTS_ARCH=all")
> > > Signed-off-by: Levi Yun <yeoreum.yun@....com>
> > > ---
> > > tools/perf/util/expr.c | 5 +----
> > > 1 file changed, 1 insertion(+), 4 deletions(-)
> > >
> > > diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c
> > > index 5e3732bc2fa5..bc119501f091 100644
> > > --- a/tools/perf/util/expr.c
> > > +++ b/tools/perf/util/expr.c
> > > @@ -285,7 +285,7 @@ struct expr_parse_ctx *expr__ctx_new(void)
> > > {
> > > struct expr_parse_ctx *ctx;
> > >
> > > - ctx = malloc(sizeof(struct expr_parse_ctx));
> > > + ctx = calloc(1, sizeof(struct expr_parse_ctx));
> > > if (!ctx)
> > > return NULL;
> > >
> > > @@ -294,9 +294,6 @@ struct expr_parse_ctx *expr__ctx_new(void)
> > > free(ctx);
> > > return NULL;
> > > }
> > > - ctx->sctx.user_requested_cpu_list = NULL;
> > > - ctx->sctx.runtime = 0;
> > > - ctx->sctx.system_wide = false;
> > >
> > > return ctx;
> > > }
> > > --
> > > LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
> > >
> > >
> >
> > Reviewed-by: James Clark <james.clark@...aro.org>
>
> Reviewed-by: Ian Rogers <irogers@...gle.com>
Thanks, applied to perf-tools-next,
- Arnaldo
Powered by blists - more mailing lists