tcp: Fix bitmask test in tcp_syn_options()
David S. Miller [Tue, 22 Jul 2008 01:45:34 +0000 (18:45 -0700)]
As reported by Alexey Dobriyan:

  CHECK   net/ipv4/tcp_output.c
net/ipv4/tcp_output.c:475:7: warning: dubious: !x & y

And sparse is damn right!

if (unlikely(!OPTION_TS & opts->options))
    ^^^
size += TCPOLEN_SACKPERM_ALIGNED;

OPTION_TS is (1 << 1), so condition will never trigger.

Signed-off-by: David S. Miller <davem@davemloft.net>

net/ipv4/tcp_output.c

index 1fa683c..a00532d 100644 (file)
@@ -472,7 +472,7 @@ static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb,
        }
        if (likely(sysctl_tcp_sack)) {
                opts->options |= OPTION_SACK_ADVERTISE;
-               if (unlikely(!OPTION_TS & opts->options))
+               if (unlikely(!(OPTION_TS & opts->options)))
                        size += TCPOLEN_SACKPERM_ALIGNED;
        }