* [PATCH] leds: blinkm: avoid uninitialized data use
@ 2017-12-04 14:45 Arnd Bergmann
2017-12-05 20:30 ` Jacek Anaszewski
0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-12-04 14:45 UTC (permalink / raw)
To: Jan-Simon Moeller, Richard Purdie, Jacek Anaszewski, Pavel Machek
Cc: Arnd Bergmann, Arvind Yadav, linux-leds, linux-kernel
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@arndb.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;
--
2.9.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] leds: blinkm: avoid uninitialized data use
2017-12-04 14:45 [PATCH] leds: blinkm: avoid uninitialized data use Arnd Bergmann
@ 2017-12-05 20:30 ` Jacek Anaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Jacek Anaszewski @ 2017-12-05 20:30 UTC (permalink / raw)
To: Arnd Bergmann, Jan-Simon Moeller, Richard Purdie, Pavel Machek
Cc: Arvind Yadav, linux-leds, linux-kernel
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@arndb.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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-05 20:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-04 14:45 [PATCH] leds: blinkm: avoid uninitialized data use Arnd Bergmann
2017-12-05 20:30 ` Jacek Anaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).