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]
Message-ID: <9bbc97e2-ab20-efb4-d055-ebce021b7c97@gmail.com>
Date:   Tue, 2 Nov 2021 22:00:06 +0530
From:   Saurav Girepunje <saurav.girepunje@...il.com>
To:     Greg KH <gregkh@...uxfoundation.org>
Cc:     Larry.Finger@...inger.net, phil@...lpotter.co.uk,
        straube.linux@...il.com, martin@...ser.cx,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org,
        saurav.girepunje@...mail.com
Subject: Re: [PATCH] staging: r8188eu: os_dep: remove the goto statement



On 01/11/21 6:31 pm, Greg KH wrote:
> On Sun, Oct 31, 2021 at 11:40:18PM +0530, Saurav Girepunje wrote:
>> Remove the goto statement from rtw_init_drv_sw(). In this function goto
>> can be replace by return statement. As on goto label exit, function
>> only return it is not performing any cleanup. Avoiding goto will
>> improve the function readability.
>>
>> Signed-off-by: Saurav Girepunje <saurav.girepunje@...il.com>
>> ---
>>  drivers/staging/r8188eu/os_dep/os_intfs.c | 39 +++++++----------------
>>  1 file changed, 12 insertions(+), 27 deletions(-)
>>
>> diff --git a/drivers/staging/r8188eu/os_dep/os_intfs.c b/drivers/staging/r8188eu/os_dep/os_intfs.c
>> index 1418c9c4916c..4b409479108e 100644
>> --- a/drivers/staging/r8188eu/os_dep/os_intfs.c
>> +++ b/drivers/staging/r8188eu/os_dep/os_intfs.c
>> @@ -480,48 +480,34 @@ u8 rtw_init_drv_sw(struct adapter *padapter)
>>  {
>>  	u8	ret8 = _SUCCESS;
>>
>> -	if ((rtw_init_cmd_priv(&padapter->cmdpriv)) == _FAIL) {
>> -		ret8 = _FAIL;
>> -		goto exit;
>> -	}
>> +	if (!rtw_init_cmd_priv(&padapter->cmdpriv))
>> +		return _FAIL;
>>
>>  	padapter->cmdpriv.padapter = padapter;
>>
>> -	if ((rtw_init_evt_priv(&padapter->evtpriv)) == _FAIL) {
>> -		ret8 = _FAIL;
>> -		goto exit;
>> -	}
>> -
>> -	if (rtw_init_mlme_priv(padapter) == _FAIL) {
>> -		ret8 = _FAIL;
>> -		goto exit;
>> -	}
>> +	if (!rtw_init_evt_priv(&padapter->evtpriv) || !rtw_init_mlme_priv(padapter))
>> +		return _FAIL;
> 
> These are functions that are being called so keeping them separate as
> the code you removed did makes it "obvious" what is happening here.
> 
> So can you keep it that way please?
> 
I will make them separate as they were.

> But my larger question is do these functions create state or allocate
> memory that needs to be unwound properly if an error does happen?  Right
> now the function seems to not be doing that at all, but that does not
> mean it is correct as-is...
> 
> thanks,
> 
> greg k-h
> Regards,
Saurav

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ