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, 5 Dec 2016 10:23:04 -0800
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Sebastian Frias <sf84@...oste.net>
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 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), but please add
actual checking.

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

             Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ