* [PATCH] hynitron_cstxxx: Initialize tmp to 0 to fix uninitialized variable issue
@ 2022-11-17 19:59 Chris Morgan
2022-11-18 6:11 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Chris Morgan @ 2022-11-17 19:59 UTC (permalink / raw)
To: linux-input; +Cc: dmitry.torokhov, Chris Morgan, Dan Carpenter
From: Chris Morgan <macromorgan@hotmail.com>
In the very unlikely event the cst3xx_i2c_write() fails inside of the
cst3xx_bootloader_enter() function 5 times in a row, the uninitalized
value of tmp will get compared to CST3XX_BOOTLDR_CHK_VAL. Initialize
the value of tmp to 0 so that in this unlikely event we are comparing
0 instead of an uninitalized variable.
Fixes: 66603243f528 ("Input: add driver for Hynitron cstxxx touchscreens")
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reported-by: Dan Carpenter <error27@gmail.com>
---
drivers/input/touchscreen/hynitron_cstxxx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/hynitron_cstxxx.c b/drivers/input/touchscreen/hynitron_cstxxx.c
index 333439fedb90..ed9056da786d 100644
--- a/drivers/input/touchscreen/hynitron_cstxxx.c
+++ b/drivers/input/touchscreen/hynitron_cstxxx.c
@@ -208,7 +208,7 @@ static int cst3xx_bootloader_enter(struct i2c_client *client)
{
int ret;
u8 retry;
- u32 tmp;
+ u32 tmp = 0;
unsigned char buf[3];
for (retry = 0; retry < 5; retry++) {
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hynitron_cstxxx: Initialize tmp to 0 to fix uninitialized variable issue
2022-11-17 19:59 [PATCH] hynitron_cstxxx: Initialize tmp to 0 to fix uninitialized variable issue Chris Morgan
@ 2022-11-18 6:11 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2022-11-18 6:11 UTC (permalink / raw)
To: Chris Morgan; +Cc: linux-input, Chris Morgan, Dan Carpenter
On Thu, Nov 17, 2022 at 01:59:21PM -0600, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
>
> In the very unlikely event the cst3xx_i2c_write() fails inside of the
> cst3xx_bootloader_enter() function 5 times in a row, the uninitalized
> value of tmp will get compared to CST3XX_BOOTLDR_CHK_VAL. Initialize
> the value of tmp to 0 so that in this unlikely event we are comparing
> 0 instead of an uninitalized variable.
>
> Fixes: 66603243f528 ("Input: add driver for Hynitron cstxxx touchscreens")
>
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> Reported-by: Dan Carpenter <error27@gmail.com>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-18 6:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-17 19:59 [PATCH] hynitron_cstxxx: Initialize tmp to 0 to fix uninitialized variable issue Chris Morgan
2022-11-18 6:11 ` Dmitry Torokhov
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).