target/linux/generic/patches-2.6.34/200-netfilter_xtables_align.patch |
| 1 | --- a/include/linux/kernel.h |
| 2 | @@ -4,6 +4,8 @@ |
| 3 | /* |
| 4 | * 'kernel.h' contains some often-used function prototypes etc |
| 5 | */ |
| 6 | +#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) |
| 7 | +#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) |
| 8 | |
| 9 | #ifdef __KERNEL__ |
| 10 | |
| 11 | @@ -37,8 +39,8 @@ extern const char linux_proc_banner[]; |
| 12 | |
| 13 | #define STACK_MAGIC 0xdeadbeef |
| 14 | |
| 15 | -#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) |
| 16 | -#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) |
| 17 | +#define ALIGN(x, a) __ALIGN_KERNEL((x), (a)) |
| 18 | +#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask)) |
| 19 | #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) |
| 20 | #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0) |
| 21 | |
| 22 | --- a/include/linux/netfilter/x_tables.h |
| 23 | @@ -1,6 +1,6 @@ |
| 24 | #ifndef _X_TABLES_H |
| 25 | #define _X_TABLES_H |
| 26 | - |
| 27 | +#include <linux/kernel.h> |
| 28 | #include <linux/types.h> |
| 29 | |
| 30 | #define XT_FUNCTION_MAXNAMELEN 30 |
| 31 | @@ -93,7 +93,7 @@ struct _xt_align { |
| 32 | __u64 u64; |
| 33 | }; |
| 34 | |
| 35 | -#define XT_ALIGN(s) ALIGN((s), __alignof__(struct _xt_align)) |
| 36 | +#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align)) |
| 37 | |
| 38 | /* Standard return verdict, or do jump. */ |
| 39 | #define XT_STANDARD_TARGET "" |
| 40 | @@ -598,7 +598,7 @@ struct _compat_xt_align { |
| 41 | compat_u64 u64; |
| 42 | }; |
| 43 | |
| 44 | -#define COMPAT_XT_ALIGN(s) ALIGN((s), __alignof__(struct _compat_xt_align)) |
| 45 | +#define COMPAT_XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _compat_xt_align)) |
| 46 | |
| 47 | extern void xt_compat_lock(u_int8_t af); |
| 48 | extern void xt_compat_unlock(u_int8_t af); |