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:   Mon, 12 Sep 2022 14:26:46 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Yu Zhe <yuzhe@...china.com>
Cc:     dinguyen@...nel.org, bp@...en8.de, mchehab@...nel.org,
        tony.luck@...el.com, james.morse@....com, rric@...nel.org,
        linux-edac@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org, liqiong@...china.com
Subject: Re: [PATCH] EDAC/altera: add platform_get_irq error checking

On Fri, Sep 09, 2022 at 01:38:38PM +0800, Yu Zhe wrote:
> The platform_get_irq() function returns negative error codes on error,
> check it.
> 
> Signed-off-by: Yu Zhe <yuzhe@...china.com>
> ---
>  drivers/edac/altera_edac.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
> index e7e8e624a436..79c7c97c7a46 100644
> --- a/drivers/edac/altera_edac.c
> +++ b/drivers/edac/altera_edac.c
> @@ -355,6 +355,8 @@ static int altr_sdram_probe(struct platform_device *pdev)
>  
>  	/* Arria10 has a 2nd IRQ */
>  	irq2 = platform_get_irq(pdev, 1);
> +	if (irq2 < 0)
> +		return irq2;

This will break the driver.  Only certain hardware has the second IRQ.
(Read the comments later in the probe).  In fact, the code works fine
as-is because devm_request_irq() will fail later if this IRQ is
required.

This code is not beautiful.  It should only request the IRQ in cases
where it is present, but it used to work correctly and now it will be
broken.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ