kernel_optimize_test/drivers/iio/gyro
Jonathan Cameron 10ab7cfd55 iio:gyro:itg3200: Fix timestamp alignment and prevent data leak.
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 a 16 byte array of smaller elements on the stack.
This is fixed by using an explicit c structure. As there are no
holes in the structure, there is no possiblity of data leakage
in this case.

The explicit alignment of ts is not strictly necessary but potentially
makes the code slightly less fragile.  It also removes the possibility
of this being cut and paste into another driver where the alignment
isn't already true.

Fixes: 36e0371e77 ("iio:itg3200: Use iio_push_to_buffers_with_timestamp()")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200722155103.979802-6-jic23@kernel.org
2020-09-21 20:01:50 +01:00
..
adis16080.c
adis16130.c
adis16136.c
adis16260.c
adxrs290.c
adxrs450.c
bmg160_core.c
bmg160_i2c.c
bmg160_spi.c
bmg160.h
fxas21002c_core.c
fxas21002c_i2c.c
fxas21002c_spi.c
fxas21002c.h
hid-sensor-gyro-3d.c
itg3200_buffer.c iio:gyro:itg3200: Fix timestamp alignment and prevent data leak. 2020-09-21 20:01:50 +01:00
itg3200_core.c
Kconfig
Makefile
mpu3050-core.c
mpu3050-i2c.c
mpu3050.h
ssp_gyro_sensor.c
st_gyro_buffer.c
st_gyro_core.c
st_gyro_i2c.c
st_gyro_spi.c
st_gyro.h