From: Steffen Klassert Date: Thu, 5 Jul 2012 23:39:34 +0000 (+0000) Subject: xfrm: Initialize the struct xfrm_dst behind the dst_enty field X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=141e369de698f2e17bf716b83fcc647ddcb2220c;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git 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 Signed-off-by: Steffen Klassert Signed-off-by: David S. Miller --- diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 6e97855b584..65bd1ca5151 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) xdst = dst_alloc(dst_ops, NULL, 0, 0, 0); if (likely(xdst)) { - memset(&xdst->u.rt6.rt6i_table, 0, - sizeof(*xdst) - sizeof(struct dst_entry)); + struct dst_entry *dst = &xdst->u.dst; + + memset(dst + 1, 0, sizeof(*xdst) - sizeof(*dst)); xdst->flo.ops = &xfrm_bundle_fc_ops; } else xdst = ERR_PTR(-ENOBUFS);