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: <alpine.DEB.2.02.1604192115300.2054@localhost6.localdomain6>
Date:	Tue, 19 Apr 2016 21:15:54 +0200 (CEST)
From:	Julia Lawall <julia.lawall@...6.fr>
To:	Joe Perches <joe@...ches.com>
cc:	cocci <cocci@...teme.lip6.fr>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: coccinelle: bool if (foo) return true; else return false;



On Tue, 19 Apr 2016, Joe Perches wrote:

> There's ~150 of these in the kernel.
> 
> Maybe there's use for this conversion to be added
> to scripts/coccinelle/misc/boolreturn.cocci or in
> a separate file.
> 
> $ cat booltruefalse.cocci
> @@
> identifier fn;
> expression e;
> typedef bool;
> symbol true;
> symbol false;
> @@
> 
> bool fn ( ... )
> {
> <...
> -	if (e) return true; else return false;
> +	return e;
> ...>
> }
> 
> @@
> identifier fn;
> expression e;
> @@
> 
> bool fn ( ... )
> {
> <...
> -	if (e) return false; else return true;
> +	return !e;
> ...>
> }

Thanks for the suggestion.  I will take care of it shortly.

julia

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ