* [PATCH] gpio: da9062: fix uninitialized variable read
@ 2019-10-01 6:25 Ahmad Fatoum
2019-10-01 7:17 ` Marco Felsch
2019-10-02 6:46 ` Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2019-10-01 6:25 UTC (permalink / raw)
To: barebox; +Cc: mfe
In cases where reg < 0x100, WARN_ON will evaluate the uninitialized
client variable. Fix this by initializing it to NULL.
This way, the function will always early-return if the reg is < 0x100.
Fixes: 17a43d293c ("gpio: add DA9062 MFD gpio support")
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
drivers/gpio/gpio-da9062.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-da9062.c b/drivers/gpio/gpio-da9062.c
index 2f018166ccc5..2d4bde7508be 100644
--- a/drivers/gpio/gpio-da9062.c
+++ b/drivers/gpio/gpio-da9062.c
@@ -37,7 +37,7 @@ static inline struct da9062_gpio *to_da9062(struct gpio_chip *chip)
static int gpio_da9062_reg_update(struct da9062_gpio *priv, unsigned int reg,
uint8_t mask, uint8_t val)
{
- struct i2c_client *client;
+ struct i2c_client *client = NULL;
uint8_t tmp;
int ret;
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: da9062: fix uninitialized variable read
2019-10-01 6:25 [PATCH] gpio: da9062: fix uninitialized variable read Ahmad Fatoum
@ 2019-10-01 7:17 ` Marco Felsch
2019-10-02 6:46 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Marco Felsch @ 2019-10-01 7:17 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox
Hi Ahmad,
thanks for covering that :)
On 19-10-01 08:25, Ahmad Fatoum wrote:
> In cases where reg < 0x100, WARN_ON will evaluate the uninitialized
> client variable. Fix this by initializing it to NULL.
> This way, the function will always early-return if the reg is < 0x100.
>
> Fixes: 17a43d293c ("gpio: add DA9062 MFD gpio support")
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> drivers/gpio/gpio-da9062.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-da9062.c b/drivers/gpio/gpio-da9062.c
> index 2f018166ccc5..2d4bde7508be 100644
> --- a/drivers/gpio/gpio-da9062.c
> +++ b/drivers/gpio/gpio-da9062.c
> @@ -37,7 +37,7 @@ static inline struct da9062_gpio *to_da9062(struct gpio_chip *chip)
> static int gpio_da9062_reg_update(struct da9062_gpio *priv, unsigned int reg,
> uint8_t mask, uint8_t val)
> {
> - struct i2c_client *client;
> + struct i2c_client *client = NULL;
> uint8_t tmp;
> int ret;
>
> --
> 2.20.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: da9062: fix uninitialized variable read
2019-10-01 6:25 [PATCH] gpio: da9062: fix uninitialized variable read Ahmad Fatoum
2019-10-01 7:17 ` Marco Felsch
@ 2019-10-02 6:46 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2019-10-02 6:46 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox, mfe
On Tue, Oct 01, 2019 at 08:25:18AM +0200, Ahmad Fatoum wrote:
> In cases where reg < 0x100, WARN_ON will evaluate the uninitialized
> client variable. Fix this by initializing it to NULL.
> This way, the function will always early-return if the reg is < 0x100.
>
> Fixes: 17a43d293c ("gpio: add DA9062 MFD gpio support")
> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
> ---
> drivers/gpio/gpio-da9062.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-02 6:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 6:25 [PATCH] gpio: da9062: fix uninitialized variable read Ahmad Fatoum
2019-10-01 7:17 ` Marco Felsch
2019-10-02 6:46 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox