All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Morgan <macroalpha82@gmail.com>
To: linux-input@vger.kernel.org
Cc: dmitry.torokhov@gmail.com, Chris Morgan <macromorgan@hotmail.com>,
	Dan Carpenter <error27@gmail.com>
Subject: [PATCH] hynitron_cstxxx: Initialize tmp to 0 to fix uninitialized variable issue
Date: Thu, 17 Nov 2022 13:59:21 -0600	[thread overview]
Message-ID: <20221117195921.2291-1-macroalpha82@gmail.com> (raw)

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


             reply	other threads:[~2022-11-17 19:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17 19:59 Chris Morgan [this message]
2022-11-18  6:11 ` [PATCH] hynitron_cstxxx: Initialize tmp to 0 to fix uninitialized variable issue Dmitry Torokhov

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=20221117195921.2291-1-macroalpha82@gmail.com \
    --to=macroalpha82@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=error27@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=macromorgan@hotmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.