[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200416222251.GC414900@krava>
Date: Fri, 17 Apr 2020 00:22:51 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Andi Kleen <andi@...stfloor.org>
Cc: acme@...nel.org, jolsa@...nel.org, linux-kernel@...r.kernel.org,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH v1] perf parse: Avoid false uncore matches
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@...nel.org>
thanks,
jirka
Powered by blists - more mailing lists