Re: [PATCH 1/3] iio: adc: xilinx-ams: fix out-of-bounds channel lookup in event handling

From: Andy Shevchenko

Date: Tue Apr 14 2026 - 06:04:59 EST


On Tue, Apr 14, 2026 at 06:29:28AM -0300, Guilherme Ivo Bozi wrote:
> ams_event_to_channel() may return a pointer past the end of
> dev->channels when no matching scan_index is found. This can lead
> to invalid memory access in ams_handle_event().
>
> Add a bounds check in ams_event_to_channel() and return NULL when
> no channel is found. Also guard the caller to safely handle this
> case.

> Fixes: <d5c70627a79455154f5f636096abe6fe57510605>

Incorrect format of the Fixes tag. Please, consult with Submitting Patches
documentation on that matter.

--
With Best Regards,
Andy Shevchenko