linux-stable/tools/iio
Matti Vaittinen 2d3dff577d tools: iio: iio_generic_buffer ensure alignment
The iio_generic_buffer can return garbage values when the total size of
scan data is not a multiple of the largest element in the scan. This can be
demonstrated by reading a scan, consisting, for example of one 4-byte and
one 2-byte element, where the 4-byte element is first in the buffer.

The IIO generic buffer code does not take into account the last two
padding bytes that are needed to ensure that the 4-byte data for next
scan is correctly aligned.

Add the padding bytes required to align the next sample with the scan size.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Fixes: e58537ccce ("staging: iio: update example application.")
Link: https://lore.kernel.org/r/ZRvlm4ktNLu+qmlf@dc78bmyyyyyyyyyyyyydt-3.rev.dnainternet.fi
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2023-10-05 16:16:20 +01:00
..
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Build tools: iio: Correctly add make dependency for iio_utils 2019-11-10 17:11:06 +00:00
Makefile kbuild: replace $(if A,A,B) with $(or A,B) 2022-02-15 12:25:56 +09:00
iio_event_monitor.c Merge branch 'ib-iio-hid-sensors-v6.6-rc1' into togreg 2023-09-24 13:39:25 +01:00
iio_generic_buffer.c tools: iio: iio_generic_buffer ensure alignment 2023-10-05 16:16:20 +01:00
iio_utils.c tools/iio/iio_utils:fix memory leak 2023-01-21 17:52:26 +00:00
iio_utils.h iio: event_monitor: Enable events before monitoring 2021-03-25 19:13:52 +00:00
lsiio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00