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] [day] [month] [year] [list]
Message-ID: <Y+DMsdD4l2qPpKjM@kroah.com>
Date:   Mon, 6 Feb 2023 10:47:29 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Michael Straube <straube.linux@...il.com>
Cc:     Larry.Finger@...inger.net, phil@...lpotter.co.uk,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] staging: r8188eu: correct error logic of
 _rtw_init_recv_priv()

On Sat, Feb 04, 2023 at 11:16:54AM +0100, Michael Straube wrote:
> Convert the function _rtw_init_recv_priv() away from returning _FAIL
> and _SUCCESS, which uses inverted error logic. Return 0 for success
> and negative values for failure instead.
> 
> Signed-off-by: Michael Straube <straube.linux@...il.com>
> ---
>  drivers/staging/r8188eu/core/rtw_recv.c   | 17 +++++------------
>  drivers/staging/r8188eu/os_dep/os_intfs.c |  2 +-
>  2 files changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
> index 70d43c10e53d..4c823bbcc22b 100644
> --- a/drivers/staging/r8188eu/core/rtw_recv.c
> +++ b/drivers/staging/r8188eu/core/rtw_recv.c
> @@ -99,10 +99,8 @@ static int rtl8188eu_init_recv_priv(struct adapter *padapter)
>  int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
>  {
>  	int i;
> -
>  	struct recv_frame *precvframe;
> -
> -	int	res = _SUCCESS;
> +	int err = 0;
>  
>  	spin_lock_init(&precvpriv->lock);
>  
> @@ -115,11 +113,8 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
>  	precvpriv->free_recvframe_cnt = NR_RECVFRAME;
>  
>  	precvpriv->pallocated_frame_buf = vzalloc(NR_RECVFRAME * sizeof(struct recv_frame) + RXFRAME_ALIGN_SZ);
> -
> -	if (!precvpriv->pallocated_frame_buf) {
> -		res = _FAIL;
> -		goto exit;
> -	}
> +	if (!precvpriv->pallocated_frame_buf)
> +		return -ENOMEM;
>  
>  	precvpriv->precv_frame_buf = (u8 *)ALIGN((size_t)(precvpriv->pallocated_frame_buf), RXFRAME_ALIGN_SZ);
>  
> @@ -139,16 +134,14 @@ int _rtw_init_recv_priv(struct recv_priv *precvpriv, struct adapter *padapter)
>  	}
>  	precvpriv->rx_pending_cnt = 1;
>  
> -	if (rtl8188eu_init_recv_priv(padapter))
> -		res = _FAIL;
> +	err = rtl8188eu_init_recv_priv(padapter);

You are keeping the original logic here, but this is odd, nothing
actually changes if this is an error except you return it?  That seems
wrong, and you might want to fix that up in further patches.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ