]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: adc: ti-ads131e08: Use new iio_push_to_buffers_with_ts() to provide length sanit...
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 13 Apr 2025 10:34:31 +0000 (11:34 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 21 May 2025 13:20:26 +0000 (14:20 +0100)
By providing the size of the buffer used, runtime checks can be performed
to ensure not overrun.

Also change the pushed data pointer to be that of the structure that also
contains the timestamp.  Not an actual bug but semantically incorrect to
push the channel data when we want the storage with the timestamp as well.

Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250413103443.2420727-9-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ti-ads131e08.c

index c6096b64664e67351e7d2a54da7c4b51adb019ea..085f0d6fb39e695dbc53218f8336ed2ff75861d5 100644 (file)
@@ -664,8 +664,8 @@ static irqreturn_t ads131e08_trigger_handler(int irq, void *private)
                i++;
        }
 
-       iio_push_to_buffers_with_timestamp(indio_dev, st->tmp_buf.data,
-               iio_get_time_ns(indio_dev));
+       iio_push_to_buffers_with_ts(indio_dev, &st->tmp_buf, sizeof(st->tmp_buf),
+                                   iio_get_time_ns(indio_dev));
 
 out:
        iio_trigger_notify_done(indio_dev->trig);