diff options
| author | Jonathan Cameron <[email protected]> | 2020-07-22 16:51:01 +0100 |
|---|---|---|
| committer | Jonathan Cameron <[email protected]> | 2020-09-21 20:01:51 +0100 |
| commit | 293e809b2e8e608b65a949101aaf7c0bd1224247 (patch) | |
| tree | 69304dc9bf266be44177c538c04be2ae0370da41 /scripts/const_structs.checkpatch | |
| parent | 39e91f3be4cba51c1560bcda3a343ed1f64dc916 (diff) | |
iio:adc:ti-adc12138 Fix alignment issue with timestamp
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.
We move to a suitable structure in the iio_priv() data with alignment
explicitly requested. This data is allocated with kzalloc so no
data can leak apart from previous readings. Note that previously
no leak at all could occur, but previous readings should never
be a problem.
In this case the timestamp location depends on what other channels
are enabled. As such we can't use a structure without misleading
by suggesting only one possible timestamp location.
Fixes: 50a6edb1b6e0 ("iio: adc: add ADC12130/ADC12132/ADC12138 ADC driver")
Reported-by: Lars-Peter Clausen <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Cc: Akinobu Mita <[email protected]>
Cc: <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'scripts/const_structs.checkpatch')
0 files changed, 0 insertions, 0 deletions