android_kernel_motorola_sm6225/tools/iio
Matti Vaittinen ae6b971786 tools: iio: iio_generic_buffer ensure alignment
[ Upstream commit 2d3dff577dd0ea8fe9637a13822f7603c4a881c8 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-20 10:29:20 +01:00
..
Build iio: tools: move to tools buildsystem 2017-08-09 14:29:36 +01:00
iio_event_monitor.c iio: Add modifier for DUV light 2018-07-23 19:18:10 +01:00
iio_generic_buffer.c tools: iio: iio_generic_buffer ensure alignment 2023-11-20 10:29:20 +01:00
iio_utils.c tools/iio/iio_utils:fix memory leak 2023-03-11 16:32:01 +01:00
iio_utils.h iio: tools: generic_buffer: increase trigger length 2017-05-07 16:08:04 +01:00
lsiio.c tools: iio: lsiio: enumerate processed channels 2016-08-15 18:33:23 +01:00
Makefile tools: fix cross-compile var clobbering 2018-02-21 15:35:42 -08:00