eb1a148ef4
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 with alignment
explicitly requested. This data is allocated with kzalloc so no
data can leak appart from previous readings.
The explicit alignment of ts is necessary to ensure consistent
padding for x86_32 in which the ts would otherwise be 4 byte aligned.
Fixes:
|
||
---|---|---|
.. | ||
ams-iaq-core.c | ||
atlas-ezo-sensor.c | ||
atlas-sensor.c | ||
bme680_core.c | ||
bme680_i2c.c | ||
bme680_spi.c | ||
bme680.h | ||
ccs811.c | ||
Kconfig | ||
Makefile | ||
pms7003.c | ||
scd30_core.c | ||
scd30_i2c.c | ||
scd30_serial.c | ||
scd30.h | ||
sgp30.c | ||
sps30.c | ||
vz89x.c |