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

Dmitry Torokhov <[email protected]>
Newsgroups org.kernel.vger.linux-input,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.