Re: [PATCH 05/50] tty_ioctl(): start taking TIOC[SG]SERIAL into separate methods
From: Johan Hovold
Date: Fri Sep 14 2018 - 12:23:58 EST
On Fri, Sep 14, 2018 at 04:18:54PM +0100, Al Viro wrote:
> On Fri, Sep 14, 2018 at 03:22:16PM +0200, Johan Hovold wrote:
> > On Thu, Sep 13, 2018 at 03:40:04AM +0100, Al Viro wrote:
> > > From: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> > >
> > > ->set_serial() and ->get_serial() resp., both taking tty and
> > > a kernel pointer to serial_struct.
> > >
> > > Signed-off-by: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> > > ---
> > > drivers/tty/tty_io.c | 36 ++++++++++++++++++++++++++++++------
> > > include/linux/tty_driver.h | 3 +++
> > > 2 files changed, 33 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
> > > index 2b34ccf269e0..91d73732e11c 100644
> > > --- a/drivers/tty/tty_io.c
> > > +++ b/drivers/tty/tty_io.c
> > > + memset(&v, 0, sizeof(struct serial_struct));
> > > +
> > > + if (!tty->ops->set_serial)
> >
> > You want get_serial here.
>
> Nice catch. Fixed.
>
> > > + return -ENOIOCTLCMD;
> > > + err = tty->ops->get_serial(tty, &v);
> > > + if (!err && copy_to_user(ss, &v, sizeof(struct serial_struct)))
> > > + err = -EFAULT;
> > > + return err;
> > > }
> > >
> > > /*
> > > @@ -2602,8 +2621,13 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> > > }
> > > break;
> > > case TIOCSSERIAL:
> > > - tty_warn_deprecated_flags(p);
> > > - break;
> > > + retval = tty_tiocsserial(tty, p);
> > > + if (retval != -ENOIOCTLCMD)
> > > + return retval;
> >
> > Missing break.
>
> *blink*
> Right you are... that's a bisect hazard (in the end of the series returns
> become unconditional anyway). Fixed.
What's in your work branch now looks good, so feel free to add:
Reviewed-by: Johan Hovold <johan@xxxxxxxxxx>
Thanks,
Johan