提交 97ef7b4c 编写于 作者: W Willem de Bruijn 提交者: David S. Miller

ip: silence udp zerocopy smatch false positive

extra_uref is used in __ip(6)_append_data only if uarg is set.

Smatch sees that the variable is passed to sock_zerocopy_put_abort.
This function accesses it only when uarg is set, but smatch cannot
infer this.

Make this dependency explicit.

Fixes: 52900d22 ("udp: elide zerocopy operation in hot path")
Signed-off-by: NWillem de Bruijn <willemb@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 83af01ba
......@@ -1130,7 +1130,8 @@ static int __ip_append_data(struct sock *sk,
error_efault:
err = -EFAULT;
error:
sock_zerocopy_put_abort(uarg, extra_uref);
if (uarg)
sock_zerocopy_put_abort(uarg, extra_uref);
cork->length -= length;
IP_INC_STATS(sock_net(sk), IPSTATS_MIB_OUTDISCARDS);
refcount_add(wmem_alloc_delta, &sk->sk_wmem_alloc);
......
......@@ -1575,7 +1575,8 @@ static int __ip6_append_data(struct sock *sk,
error_efault:
err = -EFAULT;
error:
sock_zerocopy_put_abort(uarg, extra_uref);
if (uarg)
sock_zerocopy_put_abort(uarg, extra_uref);
cork->length -= length;
IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS);
refcount_add(wmem_alloc_delta, &sk->sk_wmem_alloc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册