Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

iio: introduced iio_push_to_buffers_with_ts() that takes a data_total_len argument.

Check that data_total_len argument against iio_dev->scan_bytes.

The size needs to be at least as big as the scan. It can be larger,
which is typical if only part of fixed sized storage is used due to
a subset of channels being enabled.

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250413103443.2420727-6-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

+12
+12
include/linux/iio/buffer.h
··· 45 45 return iio_push_to_buffers(indio_dev, data); 46 46 } 47 47 48 + static inline int iio_push_to_buffers_with_ts(struct iio_dev *indio_dev, 49 + void *data, size_t data_total_len, 50 + s64 timestamp) 51 + { 52 + if (unlikely(data_total_len < indio_dev->scan_bytes)) { 53 + dev_err(&indio_dev->dev, "Undersized storage pushed to buffer\n"); 54 + return -ENOSPC; 55 + } 56 + 57 + return iio_push_to_buffers_with_timestamp(indio_dev, data, timestamp); 58 + } 59 + 48 60 int iio_push_to_buffers_with_ts_unaligned(struct iio_dev *indio_dev, 49 61 const void *data, size_t data_sz, 50 62 int64_t timestamp);