Skip to content

Commit

Permalink
mptcp: fix syncookie build error on UP
Browse files Browse the repository at this point in the history
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: 9466a1c ("mptcp: enable JOIN requests even if cookies are in use")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Florian Westphal authored and davem330 committed Aug 1, 2020
1 parent 8b66a6f commit 7126bd5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/mptcp/syncookies.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

0 comments on commit 7126bd5

Please sign in to comment.