Linux Input/HID development
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Liang Zhan <liangzhan5dev@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	 stable@vger.kernel.org
Subject: Re: [PATCH v2] Input: tca8418_keypad - fix potential infinite loop and OOB access on invalid keycodes
Date: Sat, 25 Jul 2026 21:41:36 -0700	[thread overview]
Message-ID: <amWPu_sGMCFJLN5E@google.com> (raw)
In-Reply-To: <93177ed2-10ca-40a0-9efc-95d83913e59b@gmail.com>

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

  reply	other threads:[~2026-07-26  4:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  3:41 [PATCH] Input: tca8418_keypad - fix potential infinite loop and OOB, access on I2C error Liang Zhan
2026-07-25  0:47 ` Dmitry Torokhov
2026-07-25  8:09 ` [PATCH v2] Input: tca8418_keypad - fix potential infinite loop and OOB access on invalid keycodes Liang Zhan
2026-07-26  4:41   ` Dmitry Torokhov [this message]
2026-07-26 11:57     ` Zhan Liang

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=amWPu_sGMCFJLN5E@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=liangzhan5dev@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox