aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2012-07-05 19:37:09 -0400
committerDavid S. Miller <davem@davemloft.net>2012-07-14 03:29:12 -0400
commit8104891b86b212de77063660c0c062b427526fa6 (patch)
treea90d026f1b2d43a368307880b967fa6ee45f64e5 /net/ipv6/route.c
parent921a678cb6825900478f1e8e9c59035f8c67aa32 (diff)
ipv6: Initialize the struct rt6_info behind the dst_enty field
We start initializing the struct rt6_info 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 rt6_info 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/ipv6/route.c')
-rw-r--r--net/ipv6/route.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 3151aabff5fd..2a4c8d48977f 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -280,8 +280,9 @@ static inline struct rt6_info *ip6_dst_alloc(struct net *net,
280 0, 0, flags); 280 0, 0, flags);
281 281
282 if (rt) { 282 if (rt) {
283 memset(&rt->n, 0, 283 struct dst_entry *dst = &rt->dst;
284 sizeof(*rt) - sizeof(struct dst_entry)); 284
285 memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
285 rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers); 286 rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers);
286 } 287 }
287 return rt; 288 return rt;
@@ -982,11 +983,11 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori
982 983
983 rt = dst_alloc(&ip6_dst_blackhole_ops, ort->dst.dev, 1, 0, 0); 984 rt = dst_alloc(&ip6_dst_blackhole_ops, ort->dst.dev, 1, 0, 0);
984 if (rt) { 985 if (rt) {
985 memset(&rt->rt6i_table, 0, sizeof(*rt) - sizeof(struct dst_entry));
986 rt6_init_peer(rt, net->ipv6.peers);
987
988 new = &rt->dst; 986 new = &rt->dst;
989 987
988 memset(new + 1, 0, sizeof(*rt) - sizeof(*new));
989 rt6_init_peer(rt, net->ipv6.peers);
990
990 new->__use = 1; 991 new->__use = 1;
991 new->input = dst_discard; 992 new->input = dst_discard;
992 new->output = dst_discard; 993 new->output = dst_discard;