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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170215105056.GB8207@krava>
Date:   Wed, 15 Feb 2017 11:50:56 +0100
From:   Jiri Olsa <jolsa@...hat.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Jiri Olsa <jolsa@...nel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: perf pmu: clang points out: address of array 'alias->unit' will
 always evaluate to 'true'

On Tue, Feb 14, 2017 at 03:24:35PM -0300, Arnaldo Carvalho de Melo wrote:
> util/pmu.c:948:28: error: address of array 'alias->unit' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
>         if ((info->unit && alias->unit) ||
>                         ~~ ~~~~~~~^~~~
> util/pmu.c:953:13: error: address of array 'alias->unit' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
>         if (alias->unit)
>         ~~  ~~~~~~~^~~~
> 2 errors generated.
> 
> 
> So, is this test about having something on that alias->unit array? I.e.
> should this suffice?

yep, that seems right.. good catch

thanks,
jirka

> 
> [acme@...et linux]$ cat clang.patch 
> diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> index 82a654dec666..49bfee0e3d9e 100644
> --- a/tools/perf/util/pmu.c
> +++ b/tools/perf/util/pmu.c
> @@ -945,12 +945,12 @@ static int check_info_data(struct perf_pmu_alias *alias,
>  	 * define unit, scale and snapshot, fail
>  	 * if there's more than one.
>  	 */
> -	if ((info->unit && alias->unit) ||
> +	if ((info->unit && alias->unit[0]) ||
>  	    (info->scale && alias->scale) ||
>  	    (info->snapshot && alias->snapshot))
>  		return -EINVAL;
>  
> -	if (alias->unit)
> +	if (alias->unit[0])
>  		info->unit = alias->unit;
>  
>  	if (alias->scale)
> [acme@...et linux]$ 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ