Re: [PATCH v2] iio: proximity: srf08: use stack allocated scan buffer

From: Jonathan Cameron
Date: Thu Jul 24 2025 - 07:12:21 EST


On Tue, 22 Jul 2025 10:10:38 +0100
Nuno Sá <noname.nuno@xxxxxxxxx> wrote:

> On Mon, Jul 21, 2025 at 05:21:08PM -0500, David Lechner wrote:
> > Use a stack allocated scan struct in srf08_trigger_handler(). Since the
> > scan buffer isn't used outside of this function and doesn't need to be
> > DMA-safe, it doesn't need to be in struct srf08_data. We can also
> > eliminate an extra local variable for the return value of
> > srf08_read_ranging() by using scan.chan directly.
> >
> > Reviewed-by: Andreas Klinger <ak@xxxxxxxxxxxxx>
> > Signed-off-by: David Lechner <dlechner@xxxxxxxxxxxx>
> > ---
> > Changes in v2:
> > - Zero-init the scan struct to avoid leaking uninitialized stack to userspace.
> > - Link to v1: https://lore.kernel.org/r/20250711-iio-use-more-iio_declare_buffer_with_ts-6-v1-1-25c70b990d6c@xxxxxxxxxxxx
> > ---
>
> Reviewed-by: Nuno Sá <nuno.sa@xxxxxxxxxx>
Applied to the testing branch of iio.git.

Thanks,

Jonathan