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] [day] [month] [year] [list]
Date:   Tue, 6 Dec 2016 11:10:02 +0100
From:   Sebastian Frias <sf84@...oste.net>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     zijun_hu <zijun_hu@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Mason <slash.tmp@...e.fr>,
        Harvey Harrison <harvey.harrison@...il.com>,
        Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH v2] add equivalent of BIT(x) for bitfields

On 05/12/16 19:23, Linus Torvalds wrote:
> On Mon, Dec 5, 2016 at 9:49 AM, Sebastian Frias <sf84@...oste.net> wrote:
>> Introduce GENVALUE(msb, lsb, value) macro to ease dealing with
>> continuous bitfields, just as BIT(x) does for single bits.
> 
> Oh, and looking at the implementation, this is wrong. You use "lsb"
> twice, so it mustn't have side effects.
> 
> That's fine for all expected users (since you'd expect that the only
> real use of this is with constant values for msb/lsb), 

Yes, that's what I thought.

>but please add
> actual checking.

Sure! Thanks for the advice.

> 
> You can use BUILD_BUG_ON_ZERO(!__builtin_constant_p(x)) or something.
> That returns zero, so it's easy to use in expressions.

Done. v3 of the patch is submitted.

> 
>              Linus
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ