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]
Date: Thu, 17 Aug 2023 14:36:38 +0200
From: Heiner Kallweit <hkallweit1@...il.com>
To: Ruan Jinjie <ruanjinjie@...wei.com>, rafal@...ecki.pl,
 bcm-kernel-feedback-list@...adcom.com, davem@...emloft.net,
 edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com, opendmb@...il.com,
 florian.fainelli@...adcom.com, bryan.whitehead@...rochip.com,
 andrew@...n.ch, linux@...linux.org.uk, mdf@...nel.org, pgynther@...gle.com,
 Pavithra.Sathyanarayanan@...rochip.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v2 3/4] net: bcmgenet: Fix return value check for
 fixed_phy_register()

On 17.08.2023 14:16, Ruan Jinjie wrote:
> The fixed_phy_register() function returns error pointers and never
> returns NULL. Update the checks accordingly.
> 
> And it also returns -EPROBE_DEFER, -EINVAL and -EBUSY, etc, in addition to
> -ENODEV, just return -ENODEV is not sensible, use PTR_ERR to
> fix the issue.
> 
It's right that by returning -ENODEV detail information about the
error cause is lost. However callers may rely on the function to
return -ENODEV in case of an error. Did you check for this?
Even if yes: This second part of the patch is an improvement,
and therefore should be a separate patch.

> Fixes: b0ba512e25d7 ("net: bcmgenet: enable driver to work without a device tree")
> Signed-off-by: Ruan Jinjie <ruanjinjie@...wei.com>
> ---
> v2:
> - Remove redundant NULL check and fix the return value.
> - Update the commit title and message.
> - Add the fix tag.
> ---
>  drivers/net/ethernet/broadcom/genet/bcmmii.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
> index 0092e46c46f8..97ea76d443ab 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
> @@ -617,9 +617,9 @@ static int bcmgenet_mii_pd_init(struct bcmgenet_priv *priv)
>  		};
>  
>  		phydev = fixed_phy_register(PHY_POLL, &fphy_status, NULL);
> -		if (!phydev || IS_ERR(phydev)) {
> +		if (IS_ERR(phydev)) {
>  			dev_err(kdev, "failed to register fixed PHY device\n");
> -			return -ENODEV;
> +			return PTR_ERR(phydev);
>  		}
>  
>  		/* Make sure we initialize MoCA PHYs with a link down */


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ