a24fd33527
commit 02ad21cefbac4d89ac443866f25b90449527737b 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.
As Lars also noted this anti pattern can involve a leak of data to
userspace and that indeed can happen here. We close both issues by
moving to a suitable structure in the iio_priv() data.
This data is allocated with kzalloc so no data can leak apart from
previous readings.
The explicit alignment of ts is not necessary in this case as by
coincidence the padding will end up the same, however I consider
it to make the code less fragile and have included it.
Fixes:
|
||
---|---|---|
.. | ||
ak8974.c | ||
ak8975.c | ||
bmc150_magn.c | ||
bmc150_magn.h | ||
bmc150_magn_i2c.c | ||
bmc150_magn_spi.c | ||
hid-sensor-magn-3d.c | ||
hmc5843.h | ||
hmc5843_core.c | ||
hmc5843_i2c.c | ||
hmc5843_spi.c | ||
Kconfig | ||
mag3110.c | ||
Makefile | ||
mmc35240.c | ||
st_magn.h | ||
st_magn_buffer.c | ||
st_magn_core.c | ||
st_magn_i2c.c | ||
st_magn_spi.c |