tcp: fix signed/unsigned comparison
Subsystems (3)
PATCH v2 1/1 tcp: fix signed/unsigned comparison
From: Eric Dumazet <[email protected]>
Kernel test robot reported:
smatch warnings:net/ipv4/tcp_input.c:5966 tcp_rcv_established() warn: unsigned 'reason' is never less than zero.
I actually had one packetdrill failing because of this bug, and was about to send the fix :)
v2: Andreas Schwab also pointed out that @reason needs to be negated
before we reach tcp_drop_reason()
--- net/ipv4/tcp_input.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/ipv4/tcp_input.c +3 -2
@@ -5959,9 +5959,10 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) step5: reason =tcp_ack (sk, skb,FLAG_SLOWPATH |FLAG_UPDATE_TS_RECENT ); -if (reason <0 ) +if ((int )reason <0 ) { + reason = -reason; goto discard; - + }tcp_rcv_rtt_measure_ts (sk, skb);/* Process urgent data. */
Signature · 1 line
2.36.0.rc0.470.gd361397f0d-goog
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 8 lines · On Sun, 17 Apr 2022 11:34:32 -0700 you wrote:
From: Eric Dumazet <[email protected]>
Kernel test robot reported:
smatch warnings:
net/ipv4/tcp_input.c:5966tcp_rcv_established()warn: unsigned 'reason' is never less than zero.[...]
Here is the summary with links:
- [v2,net-next] tcp: fix signed/unsigned comparison
https://git.kernel.org/netdev/net-next/c/843f77407eeb
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html