mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Ahmad Fatoum <ahmad@a3f.at>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] gpio: da9062: fix uninitialized variable read
Date: Tue, 1 Oct 2019 09:17:02 +0200	[thread overview]
Message-ID: <20191001071702.tmzghjpyupkl6fpf@pengutronix.de> (raw)
In-Reply-To: <20191001062518.1123-1-ahmad@a3f.at>

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

  reply	other threads:[~2019-10-01  7:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01  6:25 Ahmad Fatoum
2019-10-01  7:17 ` Marco Felsch [this message]
2019-10-02  6:46 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191001071702.tmzghjpyupkl6fpf@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox