public inbox for linux-perf-users@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>,
	Levi Yun <yeoreum.yun@arm.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	nd@arm.com, namhyung@kernel.org, mark.rutland@arm.com,
	james.clark2@arm.com
Subject: Re: [PATCH 1/1] perf/util: initialize is_test value in expr__ctx_new()
Date: Thu, 12 Dec 2024 16:12:00 -0300	[thread overview]
Message-ID: <Z1s1gB6FQZg3ZZqL@x1> (raw)
In-Reply-To: <CAP-5=fUSE9Pt+=T73wTUn+y_7iMZ6=bNNNgP0z_a1ty_KwV1Lw@mail.gmail.com>

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@linaro.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@arm.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@linaro.org>
> 
> Reviewed-by: Ian Rogers <irogers@google.com>

Thanks, applied to perf-tools-next,

- Arnaldo

      reply	other threads:[~2024-12-12 19:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08 14:34 [PATCH 1/1] perf/util: initialize is_test value in expr__ctx_new() Levi Yun
2024-11-13 16:13 ` James Clark
2024-11-13 16:57   ` Ian Rogers
2024-12-12 19:12     ` Arnaldo Carvalho de Melo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z1s1gB6FQZg3ZZqL@x1 \
    --to=acme@kernel.org \
    --cc=irogers@google.com \
    --cc=james.clark2@arm.com \
    --cc=james.clark@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=nd@arm.com \
    --cc=yeoreum.yun@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox