All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: pca953x: Fix uninitialized pending variable
@ 2020-09-23  9:03 Ye Li
  2020-09-23 10:38 ` Andy Shevchenko
  2020-09-24 13:07 ` Bartosz Golaszewski
  0 siblings, 2 replies; 3+ messages in thread
From: Ye Li @ 2020-09-23  9:03 UTC (permalink / raw)
  To: linus.walleij, bgolaszewski, andriy.shevchenko; +Cc: linux-gpio

When pca953x_irq_pending returns false, the pending parameter won't
be set. But pca953x_irq_handler continues using this uninitialized
variable as pending irqs and will cause problem.
Fix the issue by initializing pending to 0.

Fixes: 064c73afe738 ("gpio: pca953x: Synchronize interrupt handler properly")
Signed-off-by: Ye Li <ye.li@nxp.com>
---
 drivers/gpio/gpio-pca953x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index b5c3e566..0a49ab6 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -814,7 +814,7 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid)
 {
 	struct pca953x_chip *chip = devid;
 	struct gpio_chip *gc = &chip->gpio_chip;
-	DECLARE_BITMAP(pending, MAX_LINE);
+	DECLARE_BITMAP(pending, MAX_LINE) = {};
 	int level;
 	bool ret;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: pca953x: Fix uninitialized pending variable
  2020-09-23  9:03 [PATCH] gpio: pca953x: Fix uninitialized pending variable Ye Li
@ 2020-09-23 10:38 ` Andy Shevchenko
  2020-09-24 13:07 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2020-09-23 10:38 UTC (permalink / raw)
  To: Ye Li; +Cc: linus.walleij, bgolaszewski, linux-gpio

On Wed, Sep 23, 2020 at 02:03:44AM -0700, Ye Li wrote:
> When pca953x_irq_pending returns false, the pending parameter won't
> be set. But pca953x_irq_handler continues using this uninitialized
> variable as pending irqs and will cause problem.
> Fix the issue by initializing pending to 0.

Oops, seems you are right. Thanks!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Fixes: 064c73afe738 ("gpio: pca953x: Synchronize interrupt handler properly")
> Signed-off-by: Ye Li <ye.li@nxp.com>
> ---
>  drivers/gpio/gpio-pca953x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index b5c3e566..0a49ab6 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -814,7 +814,7 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid)
>  {
>  	struct pca953x_chip *chip = devid;
>  	struct gpio_chip *gc = &chip->gpio_chip;
> -	DECLARE_BITMAP(pending, MAX_LINE);
> +	DECLARE_BITMAP(pending, MAX_LINE) = {};
>  	int level;
>  	bool ret;
>  
> -- 
> 2.7.4
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: pca953x: Fix uninitialized pending variable
  2020-09-23  9:03 [PATCH] gpio: pca953x: Fix uninitialized pending variable Ye Li
  2020-09-23 10:38 ` Andy Shevchenko
@ 2020-09-24 13:07 ` Bartosz Golaszewski
  1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2020-09-24 13:07 UTC (permalink / raw)
  To: Ye Li; +Cc: Linus Walleij, Andy Shevchenko, linux-gpio

On Wed, Sep 23, 2020 at 11:04 AM Ye Li <ye.li@nxp.com> wrote:
>
> When pca953x_irq_pending returns false, the pending parameter won't
> be set. But pca953x_irq_handler continues using this uninitialized
> variable as pending irqs and will cause problem.
> Fix the issue by initializing pending to 0.
>
> Fixes: 064c73afe738 ("gpio: pca953x: Synchronize interrupt handler properly")
> Signed-off-by: Ye Li <ye.li@nxp.com>
> ---
>  drivers/gpio/gpio-pca953x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index b5c3e566..0a49ab6 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -814,7 +814,7 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid)
>  {
>         struct pca953x_chip *chip = devid;
>         struct gpio_chip *gc = &chip->gpio_chip;
> -       DECLARE_BITMAP(pending, MAX_LINE);
> +       DECLARE_BITMAP(pending, MAX_LINE) = {};
>         int level;
>         bool ret;
>
> --
> 2.7.4
>

Queued for fixes, thanks!

Bartosz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-24 13:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23  9:03 [PATCH] gpio: pca953x: Fix uninitialized pending variable Ye Li
2020-09-23 10:38 ` Andy Shevchenko
2020-09-24 13:07 ` Bartosz Golaszewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.