Skip to contentSkip to conversation

mptcp: fix bogus socket flag values

PATCH Applied Florian Westphal 2 participants 2 messages Feb 17, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mptcp: fix bogus socket flag values

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")
---
 net/mptcp/protocol.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/mptcp/protocol.h +2 -2
index 8a99a2930284..9f8663b30456 100644
@@ -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 {
Signature · 1 line
2.24.1
maintainer Applied
#1 lore raw

From: Florian Westphal <[email protected]>
Date: Mon, 17 Feb 2020 16:54:38 +0100

Quoted 10 lines

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').

Quoted 6 lines

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

Fixes 648ef4b88673 ("mptcp: Implement MPTCP receive path")

Applied, thanks Florian.