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]
Date:   Tue, 29 Nov 2022 09:30:27 +0800
From:   wangyufen <wangyufen@...wei.com>
To:     Leon Romanovsky <leon@...nel.org>
CC:     <bvanassche@....org>, <jgg@...pe.ca>,
        <dennis.dalessandro@...nelisnetworks.com>,
        <linux-rdma@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <andriy.shevchenko@...ux.intel.com>, <bart.vanassche@....com>,
        <easwar.hariharan@...el.com>
Subject: Re: [PATCH v3 1/2] RDMA/hfi1: Fix error return code in
 parse_platform_config()



在 2022/11/28 19:57, Leon Romanovsky 写道:
> On Sat, Nov 26, 2022 at 09:50:53PM +0800, Wang Yufen wrote:
>> In the previous while loop, "ret" may be assigned zero, so the error
>> return code may be incorrectly set to 0 instead of -EINVAL.
>> Add bail_with_einval goto label and covert all "goto bail;" to "goto
>> bail_with_einval:" where it's appropriate. Add dropping some duplicative
>> "ret = -EINVAL;" lines, as Andy suggessted.
>>
>> Fixes: 97167e813415 ("staging/rdma/hfi1: Tune for unknown channel if configuration file is absent")
>> Signed-off-by: Wang Yufen <wangyufen@...wei.com>
>> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
>> ---
>>   drivers/infiniband/hw/hfi1/firmware.c | 20 +++++++++++---------
>>   1 file changed, 11 insertions(+), 9 deletions(-)
> 
> <...>
> 
> 
>> +bail_with_einval:
>> +	ret = -EINVAL;
> 
> Sorry for being late, but no. It can be seen as anti-pattern as it
> causes to the situations where unrelated code changes can potentially
> overwrite return value. Please set valid return code before calling to
> goto.

OK, will change in v4.
Thanks
> 
> Thanks
> 
>>   bail:
>>   	memset(pcfgcache, 0, sizeof(struct platform_config_cache));
>>   	return ret;
>> -- 
>> 1.8.3.1
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ