From: Jiri Olsa <jolsa@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH v1] perf parse: Avoid false uncore matches
Date: Fri, 17 Apr 2020 00:22:51 +0200 [thread overview]
Message-ID: <20200416222251.GC414900@krava> (raw)
In-Reply-To: <20200416162119.619956-1-andi@firstfloor.org>
On Thu, Apr 16, 2020 at 09:21:19AM -0700, Andi Kleen wrote:
SNIP
> ---
> tools/perf/util/parse-events.y | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
> index 94f8bcd83582..f38c90756476 100644
> --- a/tools/perf/util/parse-events.y
> +++ b/tools/perf/util/parse-events.y
> @@ -286,7 +286,8 @@ PE_NAME opt_pmu_config
> parse_events_terms__delete(orig_terms); \
> free(list); \
> free($1); \
> - free(pattern); \
> + if ($1 != pattern) \
> + free(pattern); \
> YYABORT; \
> } while(0)
>
> @@ -303,7 +304,9 @@ PE_NAME opt_pmu_config
> struct perf_pmu *pmu = NULL;
> int ok = 0;
>
> - if (asprintf(&pattern, "%s*", $1) < 0)
> + if ($1[0] && isdigit($1[strlen($1) - 1]))
> + pattern = $1;
> + else if (asprintf(&pattern, "%s*", $1) < 0)
> CLEANUP_YYABORT;
>
> while ((pmu = perf_pmu__scan(pmu)) != NULL) {
> @@ -320,6 +323,8 @@ PE_NAME opt_pmu_config
> parse_events_terms__delete(terms);
> }
> }
> + if ($1 != pattern)
> + free(pattern);
good catch
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
prev parent reply other threads:[~2020-04-16 22:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-16 16:21 [PATCH v1] perf parse: Avoid false uncore matches Andi Kleen
2020-04-16 22:22 ` Jiri Olsa [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=20200416222251.GC414900@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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