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: <87jzug4ih3.fsf@geanix.com>
Date: Mon, 31 Jul 2023 10:02:00 +0200
From: esben@...nix.com
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: "David S. Miller" <davem@...emloft.net>,  Eric Dumazet
 <edumazet@...gle.com>,  Jakub Kicinski <kuba@...nel.org>,  Paolo Abeni
 <pabeni@...hat.com>,  Michal Simek <michal.simek@....com>,  Harini Katakam
 <harini.katakam@....com>,  Haoyue Xu <xuhaoyue1@...ilicon.com>,
  huangjunxian <huangjunxian6@...ilicon.com>,  Yang Yingliang
 <yangyingliang@...wei.com>,  Rob Herring <robh@...nel.org>,
  netdev@...r.kernel.org,  kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net] net: ll_temac: fix error checking of
 irq_of_parse_and_map()

Dan Carpenter <dan.carpenter@...aro.org> writes:

> Most kernel functions return negative error codes but some irq functions
> return zero on error.  In this code irq_of_parse_and_map(), returns zero
> and platform_get_irq() returns negative error codes.  We need to handle
> both cases appropriately.
>
> Fixes: 8425c41d1ef7 ("net: ll_temac: Extend support to non-device-tree platforms")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>

Acked-by: Esben Haabendal <esben@...nix.com>

> ---
>  drivers/net/ethernet/xilinx/ll_temac_main.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
> index e0ac1bcd9925..49f303353ecb 100644
> --- a/drivers/net/ethernet/xilinx/ll_temac_main.c
> +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
> @@ -1567,12 +1567,16 @@ static int temac_probe(struct platform_device *pdev)
>  	}
>  
>  	/* Error handle returned DMA RX and TX interrupts */
> -	if (lp->rx_irq < 0)
> -		return dev_err_probe(&pdev->dev, lp->rx_irq,
> +	if (lp->rx_irq <= 0) {
> +		rc = lp->rx_irq ?: -EINVAL;
> +		return dev_err_probe(&pdev->dev, rc,
>  				     "could not get DMA RX irq\n");
> -	if (lp->tx_irq < 0)
> -		return dev_err_probe(&pdev->dev, lp->tx_irq,
> +	}
> +	if (lp->tx_irq <= 0) {
> +		rc = lp->tx_irq ?: -EINVAL;
> +		return dev_err_probe(&pdev->dev, rc,
>  				     "could not get DMA TX irq\n");
> +	}
>  
>  	if (temac_np) {
>  		/* Retrieve the MAC address */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ