diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index c454daa78a2f..2caf54c24103 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2814,11 +2814,11 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname, if (get_user(len, optlen)) return -EFAULT; - len = min_t(unsigned int, len, sizeof(int)); - if (len < 0) return -EINVAL; + len = min_t(unsigned int, len, sizeof(int)); + switch (optname) { case UDP_CORK: val = READ_ONCE(up->corkflag);