linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: hideep - fix the uninitialized use in hideep_nvm_unlock()
@ 2021-06-15 17:26 Yizhuo Zhai
  2021-06-15 18:15 ` Dmitry Torokhov
  0 siblings, 1 reply; 8+ messages in thread
From: Yizhuo Zhai @ 2021-06-15 17:26 UTC (permalink / raw)
  To: dmitry.torokhov, linux-input, linux-kernel

Inside function hideep_nvm_unlock(), variable "unmask_code" could
be uninitialized if hideep_pgm_r_reg() returns error, however, it
is used in the later if statement after an "and" operation, which
is potentially unsafe.

Signed-off-by: Yizhuo <yzhai003@ucr.edu>
---
 drivers/input/touchscreen/hideep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/hideep.c
b/drivers/input/touchscreen/hideep.c
index ddad4a82a5e5..49b713ad4384 100644
--- a/drivers/input/touchscreen/hideep.c
+++ b/drivers/input/touchscreen/hideep.c
@@ -363,7 +363,7 @@ static int hideep_enter_pgm(struct hideep_ts *ts)

 static void hideep_nvm_unlock(struct hideep_ts *ts)
 {
-       u32 unmask_code;
+       u32 unmask_code = 0;

        hideep_pgm_w_reg(ts, HIDEEP_FLASH_CFG, HIDEEP_NVM_SFR_RPAGE);
        hideep_pgm_r_reg(ts, 0x0000000C, &unmask_code);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread
[parent not found: <CABvMjLRxy1yqXUOWqTTeq=UOsLtuPAyOSCi4SPgcbAqjMuWCCg@mail.gmail.com>]

end of thread, other threads:[~2021-06-20  6:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 17:26 [PATCH] Input: hideep - fix the uninitialized use in hideep_nvm_unlock() Yizhuo Zhai
2021-06-15 18:15 ` Dmitry Torokhov
2021-06-15 18:57   ` Yizhuo Zhai
2021-06-15 19:41     ` Dmitry Torokhov
     [not found] <CABvMjLRxy1yqXUOWqTTeq=UOsLtuPAyOSCi4SPgcbAqjMuWCCg@mail.gmail.com>
2021-06-20  5:10 ` Dmitry Torokhov
2021-06-20  5:26   ` Dmitry Torokhov
2021-06-20  5:35     ` Dmitry Torokhov
2021-06-20  6:00       ` Yizhuo Zhai

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).