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: <Z0-LgWETqKZe2uyV@shell.armlinux.org.uk>
Date: Tue, 3 Dec 2024 22:51:45 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Rosen Penev <rosenp@...il.com>
Cc: netdev@...r.kernel.org, Kurt Kanzenbach <kurt@...utronix.de>,
	Andrew Lunn <andrew@...n.ch>, Vladimir Oltean <olteanv@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Chris Snook <chris.snook@...il.com>,
	Marcin Wojtas <marcin.s.wojtas@...il.com>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
	Niklas Söderlund <niklas.soderlund@...natech.se>,
	Richard Cochran <richardcochran@...il.com>,
	open list <linux-kernel@...r.kernel.org>,
	"open list:RENESAS ETHERNET SWITCH DRIVER" <linux-renesas-soc@...r.kernel.org>
Subject: Re: [PATCHv4 net-next] net: modernize ioremap in probe

On Tue, Dec 03, 2024 at 02:27:50PM -0800, Rosen Penev wrote:
> resource aquisition and ioremap can be performed in one step.
...
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 571631a30320..af9291574931 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -7425,21 +7425,16 @@ static int mvpp2_init(struct platform_device *pdev, struct mvpp2 *priv)
>  static int mvpp2_get_sram(struct platform_device *pdev,
>  			  struct mvpp2 *priv)
>  {
> -	struct resource *res;
>  	void __iomem *base;
>  
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
> -	if (!res) {
> +	base = devm_platform_ioremap_resource(pdev, 2);
> +	if (IS_ERR(base)) {
>  		if (has_acpi_companion(&pdev->dev))
>  			dev_warn(&pdev->dev, "ACPI is too old, Flow control not supported\n");
>  		else
>  			dev_warn(&pdev->dev, "DT is too old, Flow control not supported\n");
> -		return 0;
> -	}
> -
> -	base = devm_ioremap_resource(&pdev->dev, res);
> -	if (IS_ERR(base))
>  		return PTR_ERR(base);
> +	}

This is not equivalent. This means if ioremap() fails inside
devm_platform_ioremap_resource(), we end up printing a message that
blames the firmware, which is wrong.

It also changes a "resource missing, proceed anyway" situation into
a failure situation.

Please drop this change, "cleaning" this up is introducing bugs.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ