Re: [PATCH] Input: matrix-keymap - reject keycodes above KEY_MAX
From: Dmitry Torokhov
Date: Sun Sep 13 2026 - 20:18:45 EST
On Wed, Sep 09, 2026 at 06:07:39PM +0800, Linmao Li wrote:
> matrix_keypad_map_key() validates the row and column of each entry before
> using them to update the keymap. It does not validate the keycode before
> using it as a bit number in input_dev->keybit, which only has KEY_CNT bits.
> A malformed firmware or platform keymap can therefore write past the
> bitmap.
>
> Reject keycodes above KEY_MAX before updating the keymap or capability
> bitmap.
>
> Fixes: 77a53fd21870 ("Input: matrix-keypad - add function to build device keymap")
> Signed-off-by: Linmao Li <lilinmao@xxxxxxxxxx>
Applied, thank you.
--
Dmitry