Re: [PATCH 10/12] iio: accel: kionix-kx022a: Fix array boundary check

From: Jonathan Cameron

Date: Sun Aug 16 2026 - 21:37:56 EST


On Wed, 12 Aug 2026 13:43:35 +0200
Mehdi Djait <mehdi.djait@xxxxxxxxxxxxxxx> wrote:

> 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>
Applied thanks,

Jonathan

>
> > Signed-off-by: Matti Vaittinen <mazziesaccount@xxxxxxxxx>
> > Fixes: 7c1d1677b322 ("iio: accel: Support Kionix/ROHM KX022A accelerometer")
>
> --
> Kind Regards
> Mehdi Djait