public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: Fix ALIGN() macro
@ 2006-09-23  5:31 David Miller
  2006-09-23 12:46 ` Herbert Xu
  0 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2006-09-23  5:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: torvalds, herbert


A regression or two were added by the crypto-2.6 tree merge.

I've tracked down one of them, and it's caused by the ALIGN()
macro truncating things down to "int".  Some of Herbert's new
code is aligning pointers using ALIGN() and this thus explodes
on 64-bit since the top 32-bits get chopped off.

It is arguable that perhaps we should make a special macro
for pointer aligning, but even in that case ALIGN() as a general
purpose macro should use the largest natural integer size in
order to not cause surprises for people.

I'm still trying to track down the other regression added by
the crypto merge.  I have it git bisected down to a single
changeset, but I haven't determined what's really wrong yet.
I should be able to kill that over the weekend.  I want to fix
this before merging my networking tree so I can be absolutely
sure that IPSEC doesn't break because of something in my tree :)

[KERNEL]: Do not truncate to 'int' in ALIGN() macro.

Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 851aa1b..2b2ae4f 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -31,7 +31,7 @@ #define ULLONG_MAX	(~0ULL)
 #define STACK_MAGIC	0xdeadbeef
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
+#define ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL))
 #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
 #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
 

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-09-23 23:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-23  5:31 [PATCH]: Fix ALIGN() macro David Miller
2006-09-23 12:46 ` Herbert Xu
2006-09-23 12:54   ` Herbert Xu
2006-09-23 14:40     ` Herbert Xu
2006-09-23 20:12       ` David Miller
2006-09-23 20:36       ` Kyle Moffett
2006-09-23 20:42         ` Kyle Moffett
2006-09-23 23:30         ` Herbert Xu
2006-09-23 19:57     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox