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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 29 Dec 2021 14:14:14 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Adam Kandur <sys.arch.adam@...il.com>
Cc:     linux-usb@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net/usb: remove goto in ax88772_reset()

On Wed, Dec 29, 2021 at 03:57:30PM +0300, Adam Kandur wrote:
> goto statements in ax88772_reset() in net/usb/asix_devices.c are used
> to return ret variable. As function by default returns 0 if ret
> variable >= 0 and "out:" only returns ret, I assume goto might be
> removed.
> 
> Signed-off-by: Adam Kandur <sys.arch.adam@...il.com>
> 
> ---
>  drivers/net/usb/asix_devices.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
> index 4514d35ef..9de5fc53f 100644
> --- a/drivers/net/usb/asix_devices.c
> +++ b/drivers/net/usb/asix_devices.c
> @@ -332,23 +332,20 @@ static int ax88772_reset(struct usbnet *dev)
>  	ret = asix_write_cmd(dev, AX_CMD_WRITE_NODE_ID, 0, 0,
>  			     ETH_ALEN, data->mac_addr, 0);
>  	if (ret < 0)
> -		goto out;
> +		return ret;
>  
>  	/* Set RX_CTL to default values with 2k buffer, and enable cactus */
>  	ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL, 0);
>  	if (ret < 0)
> -		goto out;
> +		return ret;
>  
>  	ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT, 0);
>  	if (ret < 0)
> -		goto out;
> +		return ret;
>  
>  	phy_start(priv->phydev);
>  
>  	return 0;
> -
> -out:
> -	return ret;
>  }

There is nothing wrong with the goto here, it's the common error path
style for the kernel.  Why should it be removed?  What is the benefit
here?

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ