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: <a0ca29ac-ce51-16e7-d0b8-c90cbb4835e6@kernel.dk>
Date:   Sun, 4 Aug 2019 14:10:05 -0700
From:   Jens Axboe <axboe@...nel.dk>
To:     Joe Perches <joe@...ches.com>,
        Leonardo Bras <leonardo@...ux.ibm.com>,
        linux-kernel@...r.kernel.org
Cc:     Dennis Zhou <dennis@...nel.org>, Hannes Reinecke <hare@...e.com>,
        Damien Le Moal <damien.lemoal@....com>,
        Tejun Heo <tj@...nel.org>,
        "Dennis Zhou (Facebook)" <dennisszhou@...il.com>,
        Johannes Thumshirn <jthumshirn@...e.de>,
        Sagi Grimberg <sagi@...mberg.me>
Subject: Re: [PATCH 1/1] block: Use bits.h macros to improve readability

On 8/4/19 1:17 PM, Joe Perches wrote:
> On Fri, 2019-08-02 at 21:18 -0700, Jens Axboe wrote:
>> On 8/1/19 6:00 PM, Leonardo Bras wrote:
>>> Applies some bits.h macros in order to improve readability of
>>> linux/blk_types.h.
> []
>> I know precisely what that does, whereas I have to think about the other
>> one, maybe even look it up to be sure. For instance, without looking
>> now, I have no idea what the second argument is. Looking at the git log,
>> I see numerous instances of:
> 
> While I'm not at all a proponent of GENMASK/GENMASK_ULL,
> and so not a proponent of this patch, latent defects are
> possible in both cases.
> 
> You'd likely have to look at SOME_SHIFT to see if it's 0
> to verify the actual mask is what's really desired.
> 
> $ git grep -P '_SHIFT\s+\(?\s*0\s*\)?\b' | wc -l
> 11907

Usually SOME_SHIFT is either a numeric value, and you already know,
or it's part of a series of enums/defines (like in the case that's
being done here) where you already have prior knowledge about the
values. For those cases, GENMASK/GENMASK_ULL adds nothing imho, it
only makes it less readable and more error prone.

-- 
Jens Axboe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ