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>
This commit is contained in:
parent
e3617433c3
commit
8f2a83b454
@ -328,9 +328,7 @@ static const struct rt6_info ip6_blk_hole_entry_template = {
|
|||||||
|
|
||||||
static void rt6_info_init(struct rt6_info *rt)
|
static void rt6_info_init(struct rt6_info *rt)
|
||||||
{
|
{
|
||||||
struct dst_entry *dst = &rt->dst;
|
memset_after(rt, 0, dst);
|
||||||
|
|
||||||
memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
|
|
||||||
INIT_LIST_HEAD(&rt->rt6i_uncached);
|
INIT_LIST_HEAD(&rt->rt6i_uncached);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user