linux/drivers/iio/pressure
Jonathan Cameron 5f8fe8ab44 iio:pressure:ms5611 Fix buffer element alignment
commit 8db4afe163 upstream.

One of a class of bugs pointed out by Lars in a recent review.
iio_push_to_buffers_with_timestamp assumes the buffer used is aligned
to the size of the timestamp (8 bytes).  This is not guaranteed in
this driver which uses an array of smaller elements on the stack.
Here there is no data leak possibility so use an explicit structure
on the stack to ensure alignment and nice readable fashion.

The forced alignment of ts isn't strictly necessary in this driver
as the padding will be correct anyway (there isn't any).  However
it is probably less fragile to have it there and it acts as
documentation of the requirement.

Fixes: 713bbb4efb ("iio: pressure: ms5611: Add triggered buffer support")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Tomasz Duszynski <tomasz.duszynski@octakon.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-07-22 09:32:54 +02:00
..
Kconfig
Makefile
abp060mg.c
bmp280-core.c
bmp280-i2c.c
bmp280-regmap.c
bmp280-spi.c
bmp280.h
cros_ec_baro.c
dps310.c
hid-sensor-press.c
hp03.c
hp206c.c
mpl115.c
mpl115.h
mpl115_i2c.c
mpl115_spi.c
mpl3115.c
ms5611.h
ms5611_core.c iio:pressure:ms5611 Fix buffer element alignment 2020-07-22 09:32:54 +02:00
ms5611_i2c.c
ms5611_spi.c
ms5637.c
st_pressure.h
st_pressure_buffer.c
st_pressure_core.c
st_pressure_i2c.c
st_pressure_spi.c
t5403.c
zpa2326.c
zpa2326.h
zpa2326_i2c.c
zpa2326_spi.c