Re: [PATCH v2] Input: gf2k: skip invalid hat lookup values
From: Dmitry Torokhov
Date: Tue Apr 07 2026 - 01:12:31 EST
On Tue, Apr 07, 2026 at 09:56:52AM +0800, Pengpeng Hou wrote:
> gf2k_read() decodes the hat position from a 4-bit field and uses it
> directly to index gf2k_hat_to_axis[]. The lookup table only has nine
> entries, so malformed packets can read past the end of the fixed table.
>
> Skip hat reporting when the decoded value falls outside the lookup
> table instead of forcing it to the neutral position. This keeps the
> fix local and avoids reporting a made-up axis state for malformed
> packets.
>
> Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
Applied, thank you.
--
Dmitry