]> err.no Git - linux-2.6/commitdiff
tcp: Fix bitmask test in tcp_syn_options()
authorDavid S. Miller <davem@davemloft.net>
Tue, 22 Jul 2008 01:45:34 +0000 (18:45 -0700)
committerDavid S. Miller <davem@davemloft.net>
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 1fa683c0ba9bcc558e58a527774823491f4323b7..a00532de2a8c17ce19238681764b518c268c0400 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;
        }