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]
Date:	Thu, 17 Sep 2015 15:33:03 -0300
From:	Arnaldo Carvalho de Melo <acme@...nel.org>
To:	Peter Senna Tschudin <peter.senna@...il.com>
Cc:	a.p.zijlstra@...llo.nl, mingo@...hat.com, jolsa@...nel.org,
	matt.fleming@...el.com, namhyung@...nel.org, milos@...hat.com,
	kan.liang@...el.com, rostedt@...dmis.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tools-perf: Change -1 by false

Em Thu, Sep 17, 2015 at 12:08:53PM +0200, Peter Senna Tschudin escreveu:
> Returning a negative value for a boolean function seem to have the
> undesired effect of returning true. Replace -1 by false in a
> bool-returning function.
> 
> The diff of the .s file before and after the change (for x86_64):
> 3907c3907
> < 	movl	$1, %ebx
> ---

Please avoid adding a --- at the start of any changeset comment line, it
breaks scripts.

Thanks, applied.

- Arnaldo

> > 	xorl	%ebx, %ebx
> 
> while if -1 is replaced by true, the diff is empty.
> 
> This issue was found by the following Coccinelle semantic patch:
> <smpl>
> @@
> identifier f;
> constant C;
> typedef bool;
> @@
> bool f (...){
> <+...
> * return -C;
> ...+>
> }
> </smpl>
> 
> Signed-off-by: Peter Senna Tschudin <peter.senna@...il.com>
> ---
>  tools/perf/util/util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> index 49a5c6a..ce465b2 100644
> --- a/tools/perf/util/util.c
> +++ b/tools/perf/util/util.c
> @@ -639,7 +639,7 @@ bool find_process(const char *name)
>  
>  	dir = opendir(procfs__mountpoint());
>  	if (!dir)
> -		return -1;
> +		return false;
>  
>  	/* Walk through the directory. */
>  	while (ret && (d = readdir(dir)) != NULL) {
> -- 
> 2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ