diff options
author | Kees Cook <keescook@chromium.org> | 2021-11-18 23:32:41 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-11-19 14:51:26 +0300 |
commit | 8f2a83b454c9b17989843756313e0180827a7ace (patch) | |
tree | f1b5bae17dbb931bc8f2163d3e98024412623a42 | |
parent | e3617433c3da3d0859a4bc67f3f975e87f650ebf (diff) | |
download | linux-8f2a83b454c9b17989843756313e0180827a7ace.tar.xz |
ipv6: Use memset_after() to zero rt6_info
In preparation for FORTIFY_SOURCE performing compile-time and run-time
field bounds checking for memset(), avoid intentionally writing across
neighboring fields.
Use memset_after() to clear everything after the dst_entry member of
struct rt6_info.
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/route.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 5e8f2f15607d..ecc6df6592a8 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -328,9 +328,7 @@ static const struct rt6_info ip6_blk_hole_entry_template = { static void rt6_info_init(struct rt6_info *rt) { - struct dst_entry *dst = &rt->dst; - - memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst)); + memset_after(rt, 0, dst); INIT_LIST_HEAD(&rt->rt6i_uncached); } |