Thread (5 messages) 5 messages, 2 authors, 2026-07-26

Re: [PATCH v2] Input: tca8418_keypad - fix potential infinite loop and OOB access on invalid keycodes

flat view

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2026-07-26 04:41:40
Also in: lkml, stable

On Sat, Jul 25, 2026 at 04:09:47PM +0800, Liang Zhan wrote:
The current code checks the raw register value against zero to detect an
empty FIFO. However, the TCA8418 datasheet defines key code 0 as the
empty-FIFO condition. If the hardware returns garbage data, the loop may
never terminate and the extracted keycode can cause an out-of-bounds access
on keymap[].

Move the empty-FIFO check to operate on the extracted key code so that
the loop terminates correctly. Additionally, validate row/column indices
against the configured matrix dimensions before indexing into the
keymap array, skipping invalid events.
Unfortunately your mailer line-wrapped the patch so it does not apply. 

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help