diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2012-07-05 19:39:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-07-14 03:29:12 -0400 |
commit | 141e369de698f2e17bf716b83fcc647ddcb2220c (patch) | |
tree | 0945d0d7baa1cedc2e2d2dd00d98102c34f67b6d /net/xfrm/xfrm_policy.c | |
parent | 8104891b86b212de77063660c0c062b427526fa6 (diff) |
xfrm: Initialize the struct xfrm_dst behind the dst_enty field
We start initializing the struct xfrm_dst at the first field
behind the struct dst_enty. This is error prone because it
might leave a new field uninitialized. So start initializing
the struct xfrm_dst right behind the dst_entry.
Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_policy.c')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 6e97855b5842..65bd1ca51517 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1353,8 +1353,9 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family) | |||
1353 | xdst = dst_alloc(dst_ops, NULL, 0, 0, 0); | 1353 | xdst = dst_alloc(dst_ops, NULL, 0, 0, 0); |
1354 | 1354 | ||
1355 | if (likely(xdst)) { | 1355 | if (likely(xdst)) { |
1356 | memset(&xdst->u.rt6.rt6i_table, 0, | 1356 | struct dst_entry *dst = &xdst->u.dst; |
1357 | sizeof(*xdst) - sizeof(struct dst_entry)); | 1357 | |
1358 | memset(dst + 1, 0, sizeof(*xdst) - sizeof(*dst)); | ||
1358 | xdst->flo.ops = &xfrm_bundle_fc_ops; | 1359 | xdst->flo.ops = &xfrm_bundle_fc_ops; |
1359 | } else | 1360 | } else |
1360 | xdst = ERR_PTR(-ENOBUFS); | 1361 | xdst = ERR_PTR(-ENOBUFS); |