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:   Sat, 16 Feb 2019 10:40:57 +0800
From:   YueHaibing <yuehaibing@...wei.com>
To:     Al Viro <viro@...iv.linux.org.uk>
CC:     Andrew Lunn <andrew@...n.ch>, <davem@...emloft.net>,
        <f.fainelli@...il.com>, <hkallweit1@...il.com>,
        <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] mdio_bus: Fix PTR_ERR() usage after
 initialization to constant


On 2019/2/1 12:24, Al Viro wrote:
> On Tue, Jan 29, 2019 at 11:30:27AM +0800, YueHaibing wrote:
>>>>  		gpiod = fwnode_get_named_gpiod(&mdiodev->dev.of_node->fwnode,
>>>>  					       "reset-gpios", 0, GPIOD_OUT_LOW,
>>>>  					       "PHY reset");
>>>> -	if (PTR_ERR(gpiod) == -ENOENT ||
>>>> -	    PTR_ERR(gpiod) == -ENOSYS)
>>>> -		gpiod = NULL;
>>>> -	else if (IS_ERR(gpiod))
>>>> -		return PTR_ERR(gpiod);
>>>> +	if (IS_ERR(gpiod)) {
>>>> +		ret = PTR_ERR(gpiod);
>>>> +		if (ret == -ENOENT || ret == -ENOSYS)
>>>> +			gpiod = NULL;
>>>> +		else
>>>> +			return ret;
>>>> +	}
> 
> Rule of the thumb: PTR_ERR(p) == -E... is almost always better off
> as p == ERR_PTR(-E...)

Ok, will fix it.

> 
> .
> 

Powered by blists - more mailing lists