diff options
author | Patrick McHardy <kaber@trash.net> | 2006-12-03 01:04:50 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-12-03 01:04:50 -0500 |
commit | f9aae95828d3478520f4bd73221bcb450ec1a5c0 (patch) | |
tree | 642e3e4b2625e476a1e31fe2e9aebd05a1e20417 | |
parent | 0c4ca1bd8638d04796553b6e678063c4fadb92cc (diff) |
[NETFILTER]: nf_conntrack: fix helper structure alignment
Adding the alignment to the size doesn't make any sense, what it
should do is align the size of the conntrack structure to the
alignment requirements of the helper structure and return an
aligned pointer in nfct_help().
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/netfilter/nf_conntrack.h | 1 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_helper.c | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index d0d0e6491448..b4beb8c799e5 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -273,6 +273,7 @@ static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) | |||
273 | if (!(ct->features & NF_CT_F_HELP)) | 273 | if (!(ct->features & NF_CT_F_HELP)) |
274 | return NULL; | 274 | return NULL; |
275 | 275 | ||
276 | offset = ALIGN(offset, __alignof__(struct nf_conn_help)); | ||
276 | return (struct nf_conn_help *) ((void *)ct + offset); | 277 | return (struct nf_conn_help *) ((void *)ct + offset); |
277 | } | 278 | } |
278 | 279 | ||
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c index 03b3ed8fca9e..2628f4ba35ee 100644 --- a/net/netfilter/nf_conntrack_helper.c +++ b/net/netfilter/nf_conntrack_helper.c | |||
@@ -97,13 +97,14 @@ static inline int unhelp(struct nf_conntrack_tuple_hash *i, | |||
97 | 97 | ||
98 | int nf_conntrack_helper_register(struct nf_conntrack_helper *me) | 98 | int nf_conntrack_helper_register(struct nf_conntrack_helper *me) |
99 | { | 99 | { |
100 | int ret; | 100 | int size, ret; |
101 | |||
101 | BUG_ON(me->timeout == 0); | 102 | BUG_ON(me->timeout == 0); |
102 | 103 | ||
104 | size = ALIGN(sizeof(struct nf_conn), __alignof__(struct nf_conn_help)) + | ||
105 | sizeof(struct nf_conn_help); | ||
103 | ret = nf_conntrack_register_cache(NF_CT_F_HELP, "nf_conntrack:help", | 106 | ret = nf_conntrack_register_cache(NF_CT_F_HELP, "nf_conntrack:help", |
104 | sizeof(struct nf_conn) | 107 | size); |
105 | + sizeof(struct nf_conn_help) | ||
106 | + __alignof__(struct nf_conn_help)); | ||
107 | if (ret < 0) { | 108 | if (ret < 0) { |
108 | printk(KERN_ERR "nf_conntrack_helper_register: Unable to create slab cache for conntracks\n"); | 109 | printk(KERN_ERR "nf_conntrack_helper_register: Unable to create slab cache for conntracks\n"); |
109 | return ret; | 110 | return ret; |