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: <Y4DRqzSGtsqTpAhU@smile.fi.intel.com>
Date:   Fri, 25 Nov 2022 16:31:07 +0200
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Wang Yufen <wangyufen@...wei.com>
Cc:     bvanassche@....org, jgg@...pe.ca, leon@...nel.org,
        dennis.dalessandro@...nelisnetworks.com,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
        bart.vanassche@....com, easwar.hariharan@...el.com
Subject: Re: [PATCH 1/2] RDMA/hfi1: Fix error return code in
 parse_platform_config()

On Fri, Nov 25, 2022 at 08:03:50PM +0800, Wang Yufen wrote:
> In the previous while loop, "ret" may be assigned zero. Therefore,
> "ret" needs to be assigned -EINVAL at the beginning of each loop.

...

>  	while (ptr < (u32 *)(dd->platform_config.data + file_length)) {
> +		ret = -EINVAL;
>  		header1 = *ptr;
>  		header2 = *(ptr + 1);
>  		if (header1 != ~header2) {

You may do it differently and simplify even existing code, i.e.

// The following two lines to add
bali_with_einval:
	ret = -EINVAL;
bail:
	memset(pcfgcache, 0, sizeof(struct platform_config_cache));
	return ret;

Then you convert all goto bail; to goto bail_with_einval; where it's
appropriate. And dropping some duplicative ret = -EINVAL; lines above.


-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ