From 97ef7b4c5501b081c6144a08bba6d87baf69b6e5 Mon Sep 17 00:00:00 2001 From: Willem de Bruijn Date: Sat, 8 Dec 2018 06:22:46 -0500 Subject: 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: 52900d22288e ("udp: elide zerocopy operation in hot path") Signed-off-by: Willem de Bruijn Signed-off-by: David S. Miller --- net/ipv4/ip_output.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'net/ipv4/ip_output.c') diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 78f028bdad30..ab6618036afe 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -1130,7 +1130,8 @@ alloc_new_skb: 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); -- cgit v1.2.3-59-g8ed1b