[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5aa46ad0-23d4-15d6-dcbe-58b37de25285@gmail.com>
Date: Tue, 5 Dec 2017 21:30:50 +0100
From: Jacek Anaszewski <jacek.anaszewski@...il.com>
To: Arnd Bergmann <arnd@...db.de>,
Jan-Simon Moeller <jansimon.moeller@....de>,
Richard Purdie <rpurdie@...ys.net>, Pavel Machek <pavel@....cz>
Cc: Arvind Yadav <arvind.yadav.cs@...il.com>,
linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] leds: blinkm: avoid uninitialized data use
Hi Arnd,
Thanks for the patch.
On 12/04/2017 03:45 PM, Arnd Bergmann wrote:
> gcc-8 reports missing error handling in blinkm_detect, when blinkm()
> fails, tmpargs[] is uninitialized:
>
> drivers/leds/leds-blinkm.c: In function 'blinkm_detect':
> drivers/leds/leds-blinkm.c:555:6: error: 'tmpargs' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> This adds a missing error checks.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
> drivers/leds/leds-blinkm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/leds/leds-blinkm.c b/drivers/leds/leds-blinkm.c
> index d03ed6b4176b..851c1920b63c 100644
> --- a/drivers/leds/leds-blinkm.c
> +++ b/drivers/leds/leds-blinkm.c
> @@ -549,8 +549,12 @@ static int blinkm_detect(struct i2c_client *client, struct i2c_board_info *info)
> /* make sure the blinkM is balanced (read/writes) */
> while (count > 0) {
> ret = blinkm_write(client, BLM_GET_ADDR, NULL);
> + if (ret)
> + return ret;
> usleep_range(5000, 10000);
> ret = blinkm_read(client, BLM_GET_ADDR, tmpargs);
> + if (ret)
> + return ret;
> usleep_range(5000, 10000);
> if (tmpargs[0] == 0x09)
> count = 0;
>
Applied.
--
Best regards,
Jacek Anaszewski
Powered by blists - more mailing lists