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, 24 Aug 2015 08:59:08 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'Vaishali Thakkar' <vthakkar1994@...il.com>
CC:	Felipe Balbi <balbi@...com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] usb: gadget: f_uac1: Convert use of
 __constant_cpu_to_le16 to cpu_to_le16

From: Vaishali Thakkar [mailto:vthakkar1994@...il.com]
> Sent: 22 August 2015 02:57
...
> >> -     .bcdADC =               __constant_cpu_to_le16(0x0100),
> >> -     .wTotalLength =         __constant_cpu_to_le16(UAC_DT_TOTAL_LENGTH),
> >> +     .bcdADC =               cpu_to_le16(0x0100),
> >> +     .wTotalLength =         cpu_to_le16(UAC_DT_TOTAL_LENGTH),
> >
> > Have you test compiled this on a big-endian system?
> > My gut feeling is that is fails.
> 
> No. I have tested it on little-endian system only. But I'll
> be really surprised if this will fail. Can you please tell me
> if I am missing something in this particular case or same
> applies for other cases because most of the cases like
> __constant_<foo> are already converted to <foo>?
> 
> As far as I know, if the argument is a constant the
> conversion happens at compile time. And unfolding both
> definitions returns to same expression. Still I am trying if
> someone can test it for me on big endian system.

Flip one to cpu_to_be16() and see if it still compiles.

Static initialisers and case labels can be expressions, but the
expression itself must only contain constants.
So it needs to be constant regardless of the value of any constants.
If it contains 'a ? t : f' then both 't' and 'f' must be constant.

In code, if 'a' is constant the optimiser discards one of 't' or 'f'.
I'm not sure what happens for non-static initialisers (they generate
odd code at the best of times).

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ