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>] [day] [month] [year] [list]
Date:	Fri, 10 Jun 2016 15:24:21 +0300
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	chengang@...ndsoft.com.cn
Cc:	Linux Kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH trivial] include/linux/mempolicy.h: Clean up code

On Fri, Jun 10, 2016 at 3:23 PM, Alexey Dobriyan <adobriyan@...il.com> wrote:
>> Use one return statement instead of multiple statements,
>> since the new return statement is still simple enough.
>
> Multiple statements are very readable exactly
> because one doesn't need to think of negations etc.
>
>> static inline bool mpol_equal(struct mempolicy *a, struct mempolicy *b)
>>  {
>> - if (a == b)
>> - return true;
>> - return __mpol_equal(a, b);
>> + return (a == b) || __mpol_equal(a, b);
>>  }
>
>
>
>>  struct mempolicy *__get_vma_policy(struct vm_area_struct *vma,
>> - unsigned long addr);
>> + unsigned long addr);
>
> For prototypes "one line per prototype, no extern" policy should be adopted.
>
>> - if (vma->vm_file &&
>> + return !(vma->vm_file &&
>>   gfp_zone(mapping_gfp_mask(vma->vm_file->f_mapping))
>> - < policy_zone)
>> - return false;
>> - return true;
>> + < policy_zone);
>
> If you align gfp_zone() call to "if (" then second test
> would even fit into one line!
>
> Who told you that shoving everything into one expression
> makes it easier to understand?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ