linux-stable/drivers/iio/pressure
Jonathan Cameron 8db4afe163 iio:pressure:ms5611 Fix buffer element alignment
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>
2020-07-05 14:22:48 +01:00
..
abp060mg.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
bmp280-core.c iio: bmp280: fix compensation of humidity 2020-05-11 20:19:19 +01:00
bmp280-i2c.c iio: pressure: bmp280: Allow device to be enumerated from ACPI 2019-12-29 15:20:10 +00:00
bmp280-regmap.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bmp280-spi.c iio: pressure: bmp280: use devm action and remove labels from probe 2019-10-22 11:10:23 +01:00
bmp280.h iio: pressure: bmp280: use devm action and remove labels from probe 2019-10-22 11:10:23 +01:00
cros_ec_baro.c iio: cros_ec: Expose hwfifo_timeout 2020-03-28 22:04:33 +01:00
dlhl60d.c iio: pressure: Add driver for DLH pressure sensors 2019-12-29 15:20:08 +00:00
dps310.c iio: dps310: Add pressure sensing capability 2019-06-08 12:33:32 +01:00
hid-sensor-press.c iio: hid-sensors: move triggered buffer setup into hid_sensor_setup_trigger 2020-05-10 09:35:53 +01:00
hp03.c iio: pressure: hp03: convert to i2c_new_dummy_device 2019-07-27 22:52:07 +01:00
hp206c.c iio: pressure: hp206c: Use get_unaligned_be24() 2020-05-03 09:47:20 +01:00
icp10100.c counter: 104-quad-8: Support Filter Clock Prescaler 2020-03-08 17:28:52 +00:00
Kconfig iio: pressure: icp10100: add driver for InvenSense ICP-101xx 2020-03-08 17:28:52 +00:00
Makefile iio: pressure: icp10100: add driver for InvenSense ICP-101xx 2020-03-08 17:28:52 +00:00
mpl115.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
mpl115.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
mpl115_i2c.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
mpl115_spi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
mpl3115.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
ms5611.h iio: pressure: ms5611: switch to SPDX identifier 2018-09-08 15:04:02 +01:00
ms5611_core.c iio:pressure:ms5611 Fix buffer element alignment 2020-07-05 14:22:48 +01:00
ms5611_i2c.c iio: pressure: ms5611: Use get_unaligned_be24() 2020-05-03 09:47:20 +01:00
ms5611_spi.c iio: pressure: ms5611: Use get_unaligned_be24() 2020-05-03 09:47:20 +01:00
ms5637.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 177 2019-05-30 11:29:19 -07:00
st_pressure.h iio: pressure: st_press: Mark default_press_pdata with __maybe_unused 2019-12-29 15:20:05 +00:00
st_pressure_buffer.c iio:st_sensors: remove buffer allocation at each buffer enable 2019-08-11 09:26:04 +01:00
st_pressure_core.c iio: st_sensors: Drop unneeded explicit castings 2020-03-21 10:26:21 +00:00
st_pressure_i2c.c iio: st_sensors: Make use of device properties 2020-01-13 21:53:39 +00:00
st_pressure_spi.c iio: st_sensors: Make use of device properties 2020-01-13 21:53:39 +00:00
t5403.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330 2019-06-05 17:37:06 +02:00
zpa2326.c iio: pressure: zpa2326: handle pm_runtime_get_sync failure 2020-06-14 15:25:04 +01:00
zpa2326.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
zpa2326_i2c.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
zpa2326_spi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00