Thread (4 messages) 4 messages, 2 authors, 2021-06-15
STALE1933d

[PATCH] Input: hideep - fix the uninitialized use in hideep_nvm_unlock()

From: Yizhuo Zhai <hidden>
Date: 2021-06-15 17:34:37
Also in: lkml

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 <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help