Skip to content

Commit bb62a76

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: conntrack: make all extensions 8-byte alignned
All extensions except one need 8 byte alignment, so just make that the default. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 8b54136 commit bb62a76

12 files changed

+2
-15
lines changed

include/net/netfilter/nf_conntrack_extend.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ enum nf_ct_ext_id {
4949
struct nf_ct_ext {
5050
u8 offset[NF_CT_EXT_NUM];
5151
u8 len;
52-
char data[];
52+
char data[] __aligned(8);
5353
};
5454

5555
static inline bool __nf_ct_ext_exist(const struct nf_ct_ext *ext, u8 id)
@@ -83,10 +83,7 @@ struct nf_ct_ext_type {
8383
void (*destroy)(struct nf_conn *ct);
8484

8585
enum nf_ct_ext_id id;
86-
87-
/* Length and min alignment. */
8886
u8 len;
89-
u8 align;
9087
};
9188

9289
int nf_ct_extend_register(const struct nf_ct_ext_type *type);

net/netfilter/nf_conntrack_acct.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ MODULE_PARM_DESC(acct, "Enable connection tracking flow accounting.");
2424

2525
static const struct nf_ct_ext_type acct_extend = {
2626
.len = sizeof(struct nf_conn_acct),
27-
.align = __alignof__(struct nf_conn_acct),
2827
.id = NF_CT_EXT_ACCT,
2928
};
3029

net/netfilter/nf_conntrack_ecache.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ static int nf_ct_events __read_mostly = NF_CT_EVENTS_DEFAULT;
306306

307307
static const struct nf_ct_ext_type event_extend = {
308308
.len = sizeof(struct nf_conntrack_ecache),
309-
.align = __alignof__(struct nf_conntrack_ecache),
310309
.id = NF_CT_EXT_ECACHE,
311310
};
312311

net/netfilter/nf_conntrack_extend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void *nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp)
6565
return NULL;
6666
}
6767

68-
newoff = ALIGN(oldlen, t->align);
68+
newoff = ALIGN(oldlen, __alignof__(struct nf_ct_ext));
6969
newlen = newoff + t->len;
7070
rcu_read_unlock();
7171

net/netfilter/nf_conntrack_helper.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,6 @@ EXPORT_SYMBOL_GPL(nf_nat_helper_unregister);
552552

553553
static const struct nf_ct_ext_type helper_extend = {
554554
.len = sizeof(struct nf_conn_help),
555-
.align = __alignof__(struct nf_conn_help),
556555
.id = NF_CT_EXT_HELPER,
557556
};
558557

net/netfilter/nf_conntrack_labels.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ EXPORT_SYMBOL_GPL(nf_connlabels_put);
8181

8282
static const struct nf_ct_ext_type labels_extend = {
8383
.len = sizeof(struct nf_conn_labels),
84-
.align = __alignof__(struct nf_conn_labels),
8584
.id = NF_CT_EXT_LABELS,
8685
};
8786

net/netfilter/nf_conntrack_seqadj.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,6 @@ EXPORT_SYMBOL_GPL(nf_ct_seq_offset);
235235

236236
static const struct nf_ct_ext_type nf_ct_seqadj_extend = {
237237
.len = sizeof(struct nf_conn_seqadj),
238-
.align = __alignof__(struct nf_conn_seqadj),
239238
.id = NF_CT_EXT_SEQADJ,
240239
};
241240

net/netfilter/nf_conntrack_timeout.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ EXPORT_SYMBOL_GPL(nf_ct_destroy_timeout);
137137

138138
static const struct nf_ct_ext_type timeout_extend = {
139139
.len = sizeof(struct nf_conn_timeout),
140-
.align = __alignof__(struct nf_conn_timeout),
141140
.id = NF_CT_EXT_TIMEOUT,
142141
};
143142

net/netfilter/nf_conntrack_timestamp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ MODULE_PARM_DESC(tstamp, "Enable connection tracking flow timestamping.");
2121

2222
static const struct nf_ct_ext_type tstamp_extend = {
2323
.len = sizeof(struct nf_conn_tstamp),
24-
.align = __alignof__(struct nf_conn_tstamp),
2524
.id = NF_CT_EXT_TSTAMP,
2625
};
2726

net/netfilter/nf_nat_core.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,6 @@ static void nf_nat_cleanup_conntrack(struct nf_conn *ct)
877877

878878
static struct nf_ct_ext_type nat_extend __read_mostly = {
879879
.len = sizeof(struct nf_conn_nat),
880-
.align = __alignof__(struct nf_conn_nat),
881880
.destroy = nf_nat_cleanup_conntrack,
882881
.id = NF_CT_EXT_NAT,
883882
};

0 commit comments

Comments
 (0)