netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] mptcp: fix bogus socket flag values
@ 2020-02-17 15:54 Florian Westphal
  2020-02-17 22:52 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2020-02-17 15:54 UTC (permalink / raw)
  To: netdev; +Cc: Florian Westphal, Dan Carpenter

Dan Carpenter reports static checker warnings due to bogus BIT() usage:

net/mptcp/subflow.c:571 subflow_write_space() warn: test_bit() takes a bit number
net/mptcp/subflow.c:694 subflow_state_change() warn: test_bit() takes a bit number
net/mptcp/protocol.c:261 ssk_check_wmem() warn: test_bit() takes a bit number
[..]

This is harmless (we use bits 1 & 2 instead of 0 and 1), but would
break eventually when adding BIT(5) (or 6, depends on size of 'long').

Just use 0 and 1, the values are only passed to test/set/clear_bit
functions.

Fixes: 648ef4b88673 ("mptcp: Implement MPTCP receive path")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/mptcp/protocol.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index 8a99a2930284..9f8663b30456 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -56,8 +56,8 @@
 #define MPTCP_DSS_FLAG_MASK	(0x1F)
 
 /* MPTCP socket flags */
-#define MPTCP_DATA_READY	BIT(0)
-#define MPTCP_SEND_SPACE	BIT(1)
+#define MPTCP_DATA_READY	0
+#define MPTCP_SEND_SPACE	1
 
 /* MPTCP connection sock */
 struct mptcp_sock {
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] mptcp: fix bogus socket flag values
  2020-02-17 15:54 [PATCH net] mptcp: fix bogus socket flag values Florian Westphal
@ 2020-02-17 22:52 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-02-17 22:52 UTC (permalink / raw)
  To: fw; +Cc: netdev, dan.carpenter

From: Florian Westphal <fw@strlen.de>
Date: Mon, 17 Feb 2020 16:54:38 +0100

> Dan Carpenter reports static checker warnings due to bogus BIT() usage:
> 
> net/mptcp/subflow.c:571 subflow_write_space() warn: test_bit() takes a bit number
> net/mptcp/subflow.c:694 subflow_state_change() warn: test_bit() takes a bit number
> net/mptcp/protocol.c:261 ssk_check_wmem() warn: test_bit() takes a bit number
> [..]
> 
> This is harmless (we use bits 1 & 2 instead of 0 and 1), but would
> break eventually when adding BIT(5) (or 6, depends on size of 'long').
> 
> Just use 0 and 1, the values are only passed to test/set/clear_bit
> functions.
> 
> Fixes: 648ef4b88673 ("mptcp: Implement MPTCP receive path")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Florian Westphal <fw@strlen.de>

Applied, thanks Florian.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-17 22:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 15:54 [PATCH net] mptcp: fix bogus socket flag values Florian Westphal
2020-02-17 22:52 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).