Re: [PATCH 00/19] IIO: Alignment fixes part 2 - struct used to ensure alignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, May 1, 2021 at 8:03 PM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
>
> I finally got around to do a manual audit of all the calls to
> iio_push_to_buffers_with_timestamp() which has the somewhat odd requirements
> of:
> 1. 8 byte alignment of the provided buffer.
> 2. space for an 8 byte naturally aligned timestamp to be inserted at the
>    end.
>
> Unfortuantely there were rather a lot of these left, but time to bite the bullet

Unfortunately

> and clean them up.
>
> As discussed previous in
> https://lore.kernel.org/linux-iio/20200920112742.170751-1-jic23@xxxxxxxxxx/
> it is not easy to fix the alignment issue without requiring a bounce buffer
> (see part 4 of the alignment fixes for a proposal for that where it is
> absolutely necessary).
>
> Part 2 is the simple cases where the timestamp position is always the same
> (as not more than 8 bytes of other scan elements) and where it is either
> in a structure that is kzalloc'd or there was already an explicit memset
> that would clear any holes in the structure (and hence avoid a potential
> kernel data leak).
>
> Cc: Peter Meerwald <pmeerw@xxxxxxxxxx>

> Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

1

> Cc: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
> Cc: Daniel Baluta <daniel.baluta@xxxxxxx>

> Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

2

One time is enough :-)

Anyway, I looked at them all and haven't seen any issues on the first glance, so
Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>

> Cc: Stefan-Gabriel Mirea <stefan-gabriel.mirea@xxxxxxx>
> Cc: Sanchayan Maity <maitysanchayan@xxxxxxxxx>
> Cc: Stephan Gerhold <stephan@xxxxxxxxxxx>
> Cc: Andreas Klinger <ak@xxxxxxxxxxxxx>
> Cc: Matt Ranostay <matt.ranostay@xxxxxxxxxxxx>
> Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
>
> Jonathan Cameron (19):
>   iio: accel: bma180: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: accel: bma220: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: accel: hid: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: accel: kxcjk-1013: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: accel: mxc4005: Fix overread of data and alignment issue.
>   iio: accel: stk8312: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: accel: stk8ba50: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: adc: ti-ads1015: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: adc: vf610: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: gyro: bmg160: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: humidity: am2315: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: prox: srf08: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: prox: pulsed-light: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: prox: as3935: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: magn: hmc5843: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: magn: bmc150: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: light: isl29125: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: light: tcs3414: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>   iio: light: tcs3472: Fix buffer alignment in
>     iio_push_to_buffers_with_timestamp()
>
>  drivers/iio/accel/bma180.c                    | 10 +++++---
>  drivers/iio/accel/bma220_spi.c                | 10 +++++---
>  drivers/iio/accel/hid-sensor-accel-3d.c       | 13 ++++++----
>  drivers/iio/accel/kxcjk-1013.c                | 24 +++++++++++--------
>  drivers/iio/accel/mxc4005.c                   | 10 +++++---
>  drivers/iio/accel/stk8312.c                   | 12 ++++++----
>  drivers/iio/accel/stk8ba50.c                  | 17 +++++++------
>  drivers/iio/adc/ti-ads1015.c                  | 12 ++++++----
>  drivers/iio/adc/vf610_adc.c                   | 10 +++++---
>  drivers/iio/gyro/bmg160_core.c                | 10 +++++---
>  drivers/iio/humidity/am2315.c                 | 16 ++++++++-----
>  drivers/iio/light/isl29125.c                  | 10 +++++---
>  drivers/iio/light/tcs3414.c                   | 10 +++++---
>  drivers/iio/light/tcs3472.c                   | 10 +++++---
>  drivers/iio/magnetometer/bmc150_magn.c        | 11 +++++----
>  drivers/iio/magnetometer/hmc5843.h            |  8 +++++--
>  drivers/iio/magnetometer/hmc5843_core.c       |  4 ++--
>  drivers/iio/proximity/as3935.c                | 10 +++++---
>  .../iio/proximity/pulsedlight-lidar-lite-v2.c | 10 +++++---
>  drivers/iio/proximity/srf08.c                 | 14 +++++------
>  20 files changed, 148 insertions(+), 83 deletions(-)
>
> --
> 2.31.1
>


-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux