* [PATCH] gpio: dwapb: fix a signedness bug handling IRQs
@ 2018-05-31 6:24 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-05-31 6:24 UTC (permalink / raw)
To: Hoan Tran, Phil Edworthy
Cc: Hoan Tran, Linus Walleij, Rob Herring, linux-kernel, kernel-janitors
Smatch flags a couple bugs here:
drivers/gpio/gpio-dwapb.c:447 dwapb_configure_irqs() warn: always true condition '(pp->irq[i] >= 0) => (0-u32max >= 0)'
drivers/gpio/gpio-dwapb.c:627 dwapb_gpio_get_pdata() warn: always true condition '(pp->irq[j] >= 0) => (0-u32max >= 0)'
The problem is that we're storing error codes in pp->irq[] so it needs
to be signed for the error handling to work correctly.
Fixes: da069d5d2b81 ("gpio: dwapb: Rework support for 1 interrupt per port A GPIO")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/include/linux/platform_data/gpio-dwapb.h b/include/linux/platform_data/gpio-dwapb.h
index 5a52d69c13f3..419cfacb4b42 100644
--- a/include/linux/platform_data/gpio-dwapb.h
+++ b/include/linux/platform_data/gpio-dwapb.h
@@ -19,7 +19,7 @@ struct dwapb_port_property {
unsigned int idx;
unsigned int ngpio;
unsigned int gpio_base;
- unsigned int irq[32];
+ int irq[32];
bool has_irq;
bool irq_shared;
};
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] gpio: dwapb: fix a signedness bug handling IRQs
@ 2018-05-31 6:24 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2018-05-31 6:24 UTC (permalink / raw)
To: Hoan Tran, Phil Edworthy
Cc: Linus Walleij, Rob Herring, linux-kernel, kernel-janitors
Smatch flags a couple bugs here:
drivers/gpio/gpio-dwapb.c:447 dwapb_configure_irqs() warn: always true condition '(pp->irq[i] >= 0) => (0-u32max >= 0)'
drivers/gpio/gpio-dwapb.c:627 dwapb_gpio_get_pdata() warn: always true condition '(pp->irq[j] >= 0) => (0-u32max >= 0)'
The problem is that we're storing error codes in pp->irq[] so it needs
to be signed for the error handling to work correctly.
Fixes: da069d5d2b81 ("gpio: dwapb: Rework support for 1 interrupt per port A GPIO")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/include/linux/platform_data/gpio-dwapb.h b/include/linux/platform_data/gpio-dwapb.h
index 5a52d69c13f3..419cfacb4b42 100644
--- a/include/linux/platform_data/gpio-dwapb.h
+++ b/include/linux/platform_data/gpio-dwapb.h
@@ -19,7 +19,7 @@ struct dwapb_port_property {
unsigned int idx;
unsigned int ngpio;
unsigned int gpio_base;
- unsigned int irq[32];
+ int irq[32];
bool has_irq;
bool irq_shared;
};
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] gpio: dwapb: fix a signedness bug handling IRQs
2018-05-31 6:24 ` Dan Carpenter
@ 2018-05-31 14:48 ` Phil Edworthy
-1 siblings, 0 replies; 4+ messages in thread
From: Phil Edworthy @ 2018-05-31 14:48 UTC (permalink / raw)
To: Dan Carpenter, Hoan Tran
Cc: Hoan Tran, Linus Walleij, Rob Herring, linux-kernel, kernel-janitors
Hi Dan,
On 31 May 2018 07:24 Dan Carpenter wrote:
> Smatch flags a couple bugs here:
>
> drivers/gpio/gpio-dwapb.c:447 dwapb_configure_irqs() warn: always true
> condition '(pp->irq[i] >= 0) => (0-u32max >= 0)'
> drivers/gpio/gpio-dwapb.c:627 dwapb_gpio_get_pdata() warn: always true
> condition '(pp->irq[j] >= 0) => (0-u32max >= 0)'
>
> The problem is that we're storing error codes in pp->irq[] so it needs to be
> signed for the error handling to work correctly.
>
> Fixes: da069d5d2b81 ("gpio: dwapb: Rework support for 1 interrupt per port
> A GPIO")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks for the patch, I had already noticed the mistake and sent a patch.
Thanks
Phil
> diff --git a/include/linux/platform_data/gpio-dwapb.h
> b/include/linux/platform_data/gpio-dwapb.h
> index 5a52d69c13f3..419cfacb4b42 100644
> --- a/include/linux/platform_data/gpio-dwapb.h
> +++ b/include/linux/platform_data/gpio-dwapb.h
> @@ -19,7 +19,7 @@ struct dwapb_port_property {
> unsigned int idx;
> unsigned int ngpio;
> unsigned int gpio_base;
> - unsigned int irq[32];
> + int irq[32];
> bool has_irq;
> bool irq_shared;
> };
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] gpio: dwapb: fix a signedness bug handling IRQs
@ 2018-05-31 14:48 ` Phil Edworthy
0 siblings, 0 replies; 4+ messages in thread
From: Phil Edworthy @ 2018-05-31 14:48 UTC (permalink / raw)
To: Dan Carpenter, Hoan Tran
Cc: Linus Walleij, Rob Herring, linux-kernel, kernel-janitors
Hi Dan,
On 31 May 2018 07:24 Dan Carpenter wrote:
> Smatch flags a couple bugs here:
>
> drivers/gpio/gpio-dwapb.c:447 dwapb_configure_irqs() warn: always true
> condition '(pp->irq[i] >= 0) => (0-u32max >= 0)'
> drivers/gpio/gpio-dwapb.c:627 dwapb_gpio_get_pdata() warn: always true
> condition '(pp->irq[j] >= 0) => (0-u32max >= 0)'
>
> The problem is that we're storing error codes in pp->irq[] so it needs to be
> signed for the error handling to work correctly.
>
> Fixes: da069d5d2b81 ("gpio: dwapb: Rework support for 1 interrupt per port
> A GPIO")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks for the patch, I had already noticed the mistake and sent a patch.
Thanks
Phil
> diff --git a/include/linux/platform_data/gpio-dwapb.h
> b/include/linux/platform_data/gpio-dwapb.h
> index 5a52d69c13f3..419cfacb4b42 100644
> --- a/include/linux/platform_data/gpio-dwapb.h
> +++ b/include/linux/platform_data/gpio-dwapb.h
> @@ -19,7 +19,7 @@ struct dwapb_port_property {
> unsigned int idx;
> unsigned int ngpio;
> unsigned int gpio_base;
> - unsigned int irq[32];
> + int irq[32];
> bool has_irq;
> bool irq_shared;
> };
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-05-31 14:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-31 6:24 [PATCH] gpio: dwapb: fix a signedness bug handling IRQs Dan Carpenter
2018-05-31 6:24 ` Dan Carpenter
2018-05-31 14:48 ` Phil Edworthy
2018-05-31 14:48 ` Phil Edworthy
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.