Commit 8104891b authored by Steffen Klassert's avatar Steffen Klassert Committed by David S. Miller

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: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 921a678c
...@@ -280,8 +280,9 @@ static inline struct rt6_info *ip6_dst_alloc(struct net *net, ...@@ -280,8 +280,9 @@ static inline struct rt6_info *ip6_dst_alloc(struct net *net,
0, 0, flags); 0, 0, flags);
if (rt) { if (rt) {
memset(&rt->n, 0, struct dst_entry *dst = &rt->dst;
sizeof(*rt) - sizeof(struct dst_entry));
memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers); rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers);
} }
return rt; return rt;
...@@ -982,11 +983,11 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori ...@@ -982,11 +983,11 @@ struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_ori
rt = dst_alloc(&ip6_dst_blackhole_ops, ort->dst.dev, 1, 0, 0); rt = dst_alloc(&ip6_dst_blackhole_ops, ort->dst.dev, 1, 0, 0);
if (rt) { if (rt) {
memset(&rt->rt6i_table, 0, sizeof(*rt) - sizeof(struct dst_entry));
rt6_init_peer(rt, net->ipv6.peers);
new = &rt->dst; new = &rt->dst;
memset(new + 1, 0, sizeof(*rt) - sizeof(*new));
rt6_init_peer(rt, net->ipv6.peers);
new->__use = 1; new->__use = 1;
new->input = dst_discard; new->input = dst_discard;
new->output = dst_discard; new->output = dst_discard;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment