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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YxkHaBKtiO9zVuKM@probook>
Date:   Wed, 7 Sep 2022 23:04:40 +0200
From:   Jonathan Neuschäfer <j.neuschaefer@....net>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Jonathan Neuschäfer <j.neuschaefer@....net>,
        Linus Walleij <linus.walleij@...aro.org>,
        openbmc@...ts.ozlabs.org, linux-gpio@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/1] pinctrl: wpcm450: Correct the fwnode_irq_get()
 return value check

Hello,

On Mon, Sep 05, 2022 at 10:14:08PM +0300, Andy Shevchenko wrote:
> fwnode_irq_get() may return all possible signed values, such as Linux
> error code. Fix the code to handle this properly.

It would be good to note explicitly here what a return value of zero
means, i.e., as the documentation of of_irq_get says, "IRQ mapping
failure", and why it should result in skipping this IRQ.

> Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> index 0dbeb91f0bf2..8193b92da403 100644
> --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> @@ -1081,10 +1081,13 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
>  
>  		girq->num_parents = 0;
>  		for (i = 0; i < WPCM450_NUM_GPIO_IRQS; i++) {
> -			int irq = fwnode_irq_get(child, i);
> +			int irq;
>  
> +			irq = fwnode_irq_get(child, i);

(Unneccesary churn, but I'll allow it)

>  			if (irq < 0)
>  				break;
> +			if (!irq)
> +				continue;

Since irq == 0 seems to be an error condition, the following seems fine
to me, and simpler:

-			if (irq < 0)
+			if (irq <= 0)
 				break;



Thanks,
Jonathan

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ