lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 14 Sep 2018 16:07:36 +0200
From:   Johan Hovold <johan@...nel.org>
To:     Al Viro <viro@...IV.linux.org.uk>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 26/50] mos7840: switch to ->get_serial()

On Thu, Sep 13, 2018 at 03:40:25AM +0100, Al Viro wrote:
> From: Al Viro <viro@...iv.linux.org.uk>
> 
> Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
> ---
>  drivers/usb/serial/mos7840.c | 40 +++++++++++++++++-----------------------
>  1 file changed, 17 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
> index b42bad85097a..8d0b80e44191 100644
> --- a/drivers/usb/serial/mos7840.c
> +++ b/drivers/usb/serial/mos7840.c
> @@ -1931,27 +1931,27 @@ static int mos7840_get_lsr_info(struct tty_struct *tty,
>   *      function to get information about serial port
>   *****************************************************************************/
>  
> -static int mos7840_get_serial_info(struct moschip_port *mos7840_port,
> -				   struct serial_struct __user *retinfo)
> +static int mos7840_get_serial_info(struct tty_struct *tty,
> +				   struct serial_struct *ss)
>  {
> -	struct serial_struct tmp;
> +	struct usb_serial_port *port = tty->driver_data;
> +	struct moschip_port *mos7840_port;
>  
> -	if (mos7840_port == NULL)
> +	if (mos7840_port_paranoia_check(port, __func__))
>  		return -1;

This really isn't necessary either even if you're just mimicking the
current ioctl code.

>  
> -	memset(&tmp, 0, sizeof(tmp));
> -
> -	tmp.type = PORT_16550A;
> -	tmp.line = mos7840_port->port->minor;
> -	tmp.port = mos7840_port->port->port_number;
> -	tmp.irq = 0;
> -	tmp.xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE;
> -	tmp.baud_base = 9600;
> -	tmp.close_delay = 5 * HZ;
> -	tmp.closing_wait = 30 * HZ;
> +	mos7840_port = mos7840_get_port_private(port);
> +	if (mos7840_port == NULL)
> +		return -1;

Same here.

> -	if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
> -		return -EFAULT;
> +	ss->type = PORT_16550A;
> +	ss->line = mos7840_port->port->minor;
> +	ss->port = mos7840_port->port->port_number;
> +	ss->irq = 0;
> +	ss->xmit_fifo_size = NUM_URBS * URB_TRANSFER_BUFFER_SIZE;
> +	ss->baud_base = 9600;
> +	ss->close_delay = 5 * HZ;
> +	ss->closing_wait = 30 * HZ;
>  	return 0;
>  }

Reviewed-by: Johan Hovold <johan@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ