Re: [PATCH 10/12] iio: accel: kionix-kx022a: Fix array boundary check
From: Mehdi Djait
Date: Wed Aug 12 2026 - 07:45:25 EST
Hi Matti,
Thank you for that patch!
On Mon, Aug 10, 2026 at 10:54:32AM +0300, Matti Vaittinen wrote:
> From: Matti Vaittinen <mazziesaccount@xxxxxxxxx>
>
> The driver performs a sanity check for an array size, when converting a
> register value to an array index. The check incorrectly accepts the
> sizeof(array) as a last index, when last valid index should be
> sizeof(array) - 1.
>
> Fix the check by bailing out when index >= sizeof(array).
>
Reviewed-by: Mehdi Djait <mehdi.djait@xxxxxxxxxxxxxxx>
> Signed-off-by: Matti Vaittinen <mazziesaccount@xxxxxxxxx>
> Fixes: 7c1d1677b322 ("iio: accel: Support Kionix/ROHM KX022A accelerometer")
--
Kind Regards
Mehdi Djait