Skip to contentSkip to conversation

mptcp: fix syncookie build error on UP

PATCH Applied Florian Westphal 2 participants 2 messages Aug 1, 2020

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

PATCH 1/1 mptcp: fix syncookie build error on UP

kernel test robot says:
net/mptcp/syncookies.c: In function 'mptcp_join_cookie_init':
include/linux/kernel.h:47:38: warning: division by zero [-Wdiv-by-zero]
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))

I forgot that spinock_t size is 0 on UP, so ARRAY_SIZE cannot be used.

Fixes 9466a1ccebbe54 ("mptcp: enable JOIN requests even if cookies are in use")
---
 net/mptcp/syncookies.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
net/mptcp/syncookies.c +1 -3
index 6eb992789b50..abe0fd099746 100644
@@ -125,8 +125,6 @@ void __init mptcp_join_cookie_init(void)
 {
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(join_entry_locks); i++)
+	for (i = 0; i < COOKIE_JOIN_SLOTS; i++)
 		spin_lock_init(&join_entry_locks[i]);
-
-	BUILD_BUG_ON(ARRAY_SIZE(join_entry_locks) != ARRAY_SIZE(join_entries));
 }
Signature · 1 line
2.26.2
maintainer Applied
#1 lore raw

From: Florian Westphal <[email protected]>
Date: Sat, 1 Aug 2020 16:39:59 +0200

Quoted 10 lines

kernel test robot says:
net/mptcp/syncookies.c: In function 'mptcp_join_cookie_init':
include/linux/kernel.h:47:38: warning: division by zero [-Wdiv-by-zero]
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))

I forgot that spinock_t size is 0 on UP, so ARRAY_SIZE cannot be used.

Fixes 9466a1ccebbe54 ("mptcp: enable JOIN requests even if cookies are in use")

Applied, thanks.