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: <20170822084615.GI23985@krava>
Date:   Tue, 22 Aug 2017 10:46:15 +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 v2 10/19] perf, tools: Dedup events in expression parsing

On Fri, Aug 11, 2017 at 04:26:25PM -0700, Andi Kleen wrote:
> From: Andi Kleen <ak@...ux.intel.com>
> 
> Avoid adding redundant events while parsing an expression.
> When we add an "other" event check first if it already exists.
> 
> v2: Fix perf test failure.
> Signed-off-by: Andi Kleen <ak@...ux.intel.com>

Acked-by: Jiri Olsa <jolsa@...nel.org>

thanks,
jirka

> ---
>  tools/perf/util/expr.y | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/expr.y b/tools/perf/util/expr.y
> index 5753c4f21534..432b8560cf51 100644
> --- a/tools/perf/util/expr.y
> +++ b/tools/perf/util/expr.y
> @@ -181,6 +181,19 @@ void expr__ctx_init(struct parse_ctx *ctx)
>  	ctx->num_ids = 0;
>  }
>  
> +static bool already_seen(const char *val, const char *one, const char **other,
> +			 int num_other)
> +{
> +	int i;
> +
> +	if (one && !strcasecmp(one, val))
> +		return true;
> +	for (i = 0; i < num_other; i++)
> +		if (!strcasecmp(other[i], val))
> +			return true;
> +	return false;
> +}
> +
>  int expr__find_other(const char *p, const char *one, const char ***other,
>  		     int *num_otherp)
>  {
> @@ -200,7 +213,7 @@ int expr__find_other(const char *p, const char *one, const char ***other,
>  			err = 0;
>  			break;
>  		}
> -		if (tok == ID && (!one || strcasecmp(one, val.id))) {
> +		if (tok == ID && !already_seen(val.id, one, *other, num_other)) {
>  			if (num_other >= EXPR_MAX_OTHER - 1) {
>  				pr_debug("Too many extra events in %s\n", orig);
>  				break;
> -- 
> 2.9.4
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ