Re: [PATCH net-next 6/9] net: tcp: use kfree_skb_reason() for tcp_v{4,6}_do_rcv()

From: Jakub Kicinski
Date: Wed Feb 16 2022 - 10:56:05 EST


On Wed, 16 Feb 2022 11:54:23 +0800 menglong8.dong@xxxxxxxxx wrote:
> From: Menglong Dong <imagedong@xxxxxxxxxxx>
>
> Replace kfree_skb() used in tcp_v4_do_rcv() and tcp_v6_do_rcv() with
> kfree_skb_reason().
>
> Signed-off-by: Menglong Dong <imagedong@xxxxxxxxxxx>

Clang says:

net/ipv6/tcp_ipv6.c:1556:6: warning: variable 'reason' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (tcp_rcv_state_process(sk, skb))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/ipv6/tcp_ipv6.c:1567:24: note: uninitialized use occurs here
kfree_skb_reason(skb, reason);
^~~~~~
net/ipv6/tcp_ipv6.c:1556:2: note: remove the 'if' if its condition is always false
if (tcp_rcv_state_process(sk, skb))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/ipv6/tcp_ipv6.c:1547:8: warning: variable 'reason' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (tcp_child_process(sk, nsk, skb))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/ipv6/tcp_ipv6.c:1567:24: note: uninitialized use occurs here
kfree_skb_reason(skb, reason);
^~~~~~
net/ipv6/tcp_ipv6.c:1547:4: note: remove the 'if' if its condition is always false
if (tcp_child_process(sk, nsk, skb))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
net/ipv6/tcp_ipv6.c:1543:7: warning: variable 'reason' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!nsk)
^~~~
net/ipv6/tcp_ipv6.c:1567:24: note: uninitialized use occurs here
kfree_skb_reason(skb, reason);
^~~~~~
net/ipv6/tcp_ipv6.c:1543:3: note: remove the 'if' if its condition is always false
if (!nsk)
^~~~~~~~~
net/ipv6/tcp_ipv6.c:1479:2: note: variable 'reason' is declared here
enum skb_drop_reason reason;
^