Re: [RFC PATCH 2/4] net: pass 'optlen_t' to proto[ops].getsockopt() hooks

Stefan Metzmacher
2025-03-31T20:27:25Z

> diff --git a/net/socket.c b/net/socket.c
> index 9a0e720f0859..fa2de12c10e6 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -2350,12 +2350,15 @@ int do_sock_getsockopt(struct socket *sock, bool compat, int level,
> } else if (unlikely(!ops->getsockopt)) {
> err = -EOPNOTSUPP;
> } else {
> - if (WARN_ONCE(optval.is_kernel || optlen.is_kernel,
> + optlen_t _optlen = { .up = NULL, };
> +
> + if (WARN_ONCE(optval.is_kernel,

Sorry, the removal of '|| optlen.is_kernel' should be in the next commit...

> "Invalid argument type"))
> return -EOPNOTSUPP;