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: <48B570D6.7070301@csr.com>
Date:	Wed, 27 Aug 2008 16:20:54 +0100
From:	David Vrabel <david.vrabel@....com>
To:	Al Viro <viro@...IV.linux.org.uk>
CC:	Roland Dreier <rdreier@...co.com>,
	Kernel development list <linux-kernel@...r.kernel.org>,
	linux-usb <linux-usb@...r.kernel.org>,
	torvalds@...ux-foundation.org
Subject: Re: [patch] Add helper macros for little-endian bitfields

Al Viro wrote:
> On Sun, Aug 24, 2008 at 06:37:43PM -0700, Roland Dreier wrote:
>>  > + * NOTE: When using multibyte bitfields, you need to convert the data
>>  > + *       from Little Endian to CPU before you can access the bitfield
>>  > + *       (to make it simpler):
> 
> NOTE: When tempted to use multibyte bitfields on fixed-layout data, you
> need to look in the mirror, ask yourself "what will they do to me during
> code review for that?", shudder and decide that some temptations are
> just not worth the pain.

But why is this worthy of a crispy flaming?  I've not seen anything
definite beyond a somewhat vague 'some compilers don't optimize
bitfields very well'.

The structure definition and the DECL_BF_LEx() macros might be ugly but
the code using the structures is clearer.  For example,

    get_random_bytes(&tiebreaker, sizeof(unsigned));
    drp_ie->tiebreaker = tiebreaker & 1;

versus

    get_random_bytes(&tiebreaker, sizeof(unsigned));
    drp_ie->drp_control |= (tiebreaker & 1)
            ? UWB_DRP_IE_DRP_CTRL_TIEBREAKER : 0;

David
-- 
David Vrabel, Senior Software Engineer, Drivers
CSR, Churchill House, Cambridge Business Park,  Tel: +44 (0)1223 692562
Cowley Road, Cambridge, CB4 0WZ                 http://www.csr.com/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ