]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mptcp: Change some dubious min_t(int, ...) to min()
authorDavid Laight <david.laight.linux@gmail.com>
Tue, 3 Feb 2026 18:41:22 +0000 (19:41 +0100)
committerJakub Kicinski <kuba@kernel.org>
Thu, 5 Feb 2026 02:45:09 +0000 (18:45 -0800)
commitb582090005d5c66bfdb73a85b91ddb42a868aff6
treea6e6cc639ddff0195800d9b863576dd258ff36a1
parentd7e712b66f9b3da11e7f523228409af6d56237cb
mptcp: Change some dubious min_t(int, ...) to min()

There are two:

min_t(int, xxx, mptcp_wnd_end(msk) - msk->snd_nxt);

Both mptcp_wnd_end(msk) and msk->snd_nxt are u64, their difference
(aka the window size) might be limited to 32 bits - but that isn't
knowable from this code.
So checks being added to min_t() detect the potential discard of
significant bits.

Provided the 'avail_size' and return of mptcp_check_allowed_size()
are changed to an unsigned type (size_t matches the type the caller
uses) both min_t() can be changed to min().

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
[ wrapped too long lines when declaring mptcp_check_allowed_size() ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260203-net-next-mptcp-misc-feat-6-20-v1-6-31ec8bfc56d1@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mptcp/protocol.c