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] [day] [month] [year] [list]
Message-ID: <YCFYtv/yC124CTaR@hovoldconsulting.com>
Date:   Mon, 8 Feb 2021 16:28:54 +0100
From:   Johan Hovold <johan@...nel.org>
To:     Uwe Kleine-König <uwe@...ine-koenig.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/2] USB: serial: Drop if with an always false
 condition

On Mon, Feb 08, 2021 at 03:31:48PM +0100, Uwe Kleine-König wrote:
> In a bus remove function the passed device is always valid, so there is
> no need to check for it being NULL.
> 
> (Side note: The check for port being non-NULL is broken anyhow, because
> to_usb_serial_port() is a wrapper around container_of() for a member that is
> not the first one. So port can hardly become NULL.)

Right, this check was just broken. I don't think it was even intended to
catch a NULL struct device pointer. Note that there's two more in
match() and probe() that I'll remove in a follow up.

> Signed-off-by: Uwe Kleine-König <uwe@...ine-koenig.org>
> ---
>  drivers/usb/serial/bus.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
> index eb0195cf37dd..d862ed656414 100644
> --- a/drivers/usb/serial/bus.c
> +++ b/drivers/usb/serial/bus.c
> @@ -87,15 +87,11 @@ static int usb_serial_device_probe(struct device *dev)
>  static int usb_serial_device_remove(struct device *dev)
>  {
>  	struct usb_serial_driver *driver;
> -	struct usb_serial_port *port;
> +	struct usb_serial_port *port = to_usb_serial_port(dev);
>  	int retval = 0;
>  	int minor;
>  	int autopm_err;
>  
> -	port = to_usb_serial_port(dev);
> -	if (!port)
> -		return -ENODEV;
> -
>  	/*
>  	 * Make sure suspend/resume doesn't race against port_remove.
>  	 *
> 
> base-commit: 5c8fe583cce542aa0b84adc939ce85293de36e5e

Both patches now applied, thanks.

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ