Re: [PATCH net-next] tcp: fix incorrect parameter validation in the do_tcp_getsockopt() function

From: Gavrilov Ilia
Date: Wed Mar 06 2024 - 06:54:54 EST


On 3/6/24 14:36, Paolo Abeni wrote:
> The above is incorrect, as the 'len' variable is a signed integer

I mean, if 'len' is negative then after this expression
len = min_t(unsigned int, len, sizeof(int));
the 'len' variable will be equal to sizeof(int) == 4
and the statement
if (len < 0) return -EINVAL;
might be unreachable during program execution.