Subject: Re: [PATCH net-next 4/6] l2tp: ppp: convert to getsockopt_iter

From: Breno Leitao <[email-masked]>
Date: Fri, 15 May 2026 01:15:10 -0700

On Wed, May 13, 2026 at 08:32:39AM -0700, Stanislav Fomichev wrote:
> > @@ -1358,12 +1357,11 @@ static int pppol2tp_getsockopt(struct socket *sock, int level, int optname,
> >  			goto end_put_sess;
> >  	}
> >  
> > -	err = -EFAULT;
> > -	if (put_user(len, optlen))
> > -		goto end_put_sess;
> > -
> > -	if (copy_to_user((void __user *)optval, &val, len))
> > +	opt->optlen = len;
> > +	if (copy_to_iter(&val, len, &opt->iter_out) != len) {
> > +		err = -EFAULT;
> >  		goto end_put_sess;
> > +	}
> >  
> >  	err = 0;
> 
> nit: if you're moving `err = -EFAULT`, you might as well remove this
> `err = 0` ?

Good point, if we got here, err is already = 0, and this line becomes
useless.

Also, we probably don't need the "goto end_put_sess;" above, given the
next line is the "end_put_sess" label.

Thanks for the review, I will update.
--breno