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:	Mon, 30 May 2016 22:21:03 +0800
From:	Chen Gang <chengang@...ndsoft.com.cn>
To:	Joe Perches <joe@...ches.com>, akpm@...ux-foundation.org,
	trivial@...nel.org
CC:	kuleshovmail@...il.com, tony.luck@...el.com,
	tangchen@...fujitsu.com, will.deacon@....com, holt@....com,
	ard.biesheuvel@...aro.org, kirill.shutemov@...ux.intel.com,
	linux-kernel@...r.kernel.org, Chen Gang <gang.chen.5i5j@...il.com>
Subject: Re: [PATCH trivial] include/linux/memblock.h: Clean up code for several
 trivial details

On 5/29/16 23:08, Joe Perches wrote:
> On Sun, 2016-05-29 at 22:36 +0800, chengang@...ndsoft.com.cn wrote:
>>
>> Use "!!" to let the boolean function return boolean value directly.
> []
>> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> []
>> @@ -191,12 +190,12 @@ static inline bool movable_node_is_enabled(void)
>>  
>>  static inline bool memblock_is_mirror(struct memblock_region *m)
>>  {
>> -	return m->flags & MEMBLOCK_MIRROR;
>> +	return !!(m->flags & MEMBLOCK_MIRROR);
> 
> These !! uses are't necessary.
> The compiler makes the bool return 0 or 1.
> 

No, they are not necessary. But for me, it will be more clearer, since
in our kernel (at least in include/linux/), almost all Boolean functions
use Boolean value or expression for return (and "!!" are often used).

Please help check, and welcome any additional ideas, suggestions, and
completions.

Thanks.
-- 
Chen Gang (陈刚)

Managing Natural Environments is the Duty of Human Beings.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ