Message ID | 20200819215238.830c1bd10b2e.I316de8a67c79a393ae1826a1b2dcc08f31b1856e@changeid |
---|---|
State | Superseded |
Headers | show |
Series | [v2] netlink: fix state reallocation in policy export | expand |
diff --git a/net/netlink/policy.c b/net/netlink/policy.c index f6491853c797..2b3e26f7496f 100644 --- a/net/netlink/policy.c +++ b/net/netlink/policy.c @@ -51,6 +51,9 @@ static int add_policy(struct nl_policy_dump **statep, if (!state) return -ENOMEM; + memset(&state->policies[state->n_alloc], 0, + flex_array_size(state, policies, n_alloc - state->n_alloc)); + state->policies[state->n_alloc].policy = policy; state->policies[state->n_alloc].maxtype = maxtype; state->n_alloc = n_alloc;