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: <Pine.LNX.4.64.0611261415530.3483@woody.osdl.org>
Date:	Sun, 26 Nov 2006 14:20:10 -0800 (PST)
From:	Linus Torvalds <torvalds@...l.org>
To:	Roland Dreier <rdreier@...co.com>
cc:	Andrew Morton <akpm@...l.org>, David Miller <davem@...emloft.net>,
	linux-kernel@...r.kernel.org, openib-general@...nib.org,
	tom@...ngridcomputing.com, Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH] Avoid truncating to 'long' in ALIGN() macro



On Sun, 26 Nov 2006, Roland Dreier wrote:
>
>  > +#define ALIGN(x,a)		__ALIGN_MASK(x,(typeof(x))(a)-1)
>  > +#define __ALIGN_MASK(x,mask)	(((x)+(mask))&~(mask))
> 
> Fine by me, but it loses the extra (typeof(x)) cast that Al wanted to
> make sure that the result of ALIGN() is not wider than x.

Well, since "mask" is now made to be of the same type as "x", every 
sub-expression actually has the same type, modulo the normal C behaviour 
of "expand to at least "int".

So arguably, the result is _more_ like a normal C operation this way. 
Type-wise, the "ALIGN()" macro acts like any other C operation (ie if you 
feed it an "unsigned char", the end result is an "int" due to the normal C 
type widening that happens for all C operations).

But I don't care horribly much. Al may have some other reasons to _not_ 
want the normal C type expansion to happen (ie maybe he does something 
unnatural with sparse ;)

			Linus
-
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