[PATCH]: Fix ALIGN() macro
From: David Miller
Date: Sat Sep 23 2006 - 01:32:02 EST
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@xxxxxxxxxxxxx>
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))
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/