Re: [PATCH v2] Input: aiptek: validate raw macro indices before updating state

From: Dmitry Torokhov

Date: Tue Apr 07 2026 - 01:12:36 EST


On Sun, Mar 29, 2026 at 08:17:11AM +0800, Pengpeng Hou wrote:
> aiptek_irq() derives macro key indices directly from tablet reports and
> then uses them to index macroKeyEvents[]. Report types 4 and 5 also save
> the derived value in aiptek->lastMacro and later use that state to
> release the previous key.
>
> Validate the raw macro index once before it enters that state machine, so
> lastMacro only ever stores an in-range macro key. Keep direct bounds
> checks for report type 6, which reads the macro number from the packet
> body and uses it immediately.
>
> Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>

Applied, thank you.

--
Dmitry