Skip to content

IIO: Alignment fixes part 2 - struct used to ensure alignment

Jonathan Cameron linux-iio 1 version Applied

Status from this message: Applied to the togreg branch of iio.git with a minor fix.

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest19 patches 15 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/19iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/accel/bma180.c+7 -31 reply
2/19iio: accel: bma220: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/accel/bma220_spi.c+7 -31 reply
3/19iio: accel: hid: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/accel/hid-sensor-accel-3d.c+8 -51 reply
4/19iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/accel/kxcjk-1013.c+14 -102 replies
5/19iio: accel: mxc4005: Fix overread of data and alignment issue.drivers/iio/accel/mxc4005.c+7 -31 reply
6/19iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/accel/stk8312.c+8 -41 reply
7/19iio: accel: stk8ba50: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/accel/stk8ba50.c+8 -90 replies
8/19iio: adc: ti-ads1015: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/adc/ti-ads1015.c+8 -40 replies
9/19iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/adc/vf610_adc.c+7 -30 replies
10/19iio: gyro: bmg160: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/gyro/bmg160_core.c+7 -30 replies
11/19iio: humidity: am2315: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/humidity/am2315.c+10 -60 replies
12/19iio: prox: srf08: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/proximity/srf08.c+7 -70 replies
13/19iio: prox: pulsed-light: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/proximity/pulsedlight-lidar-lite-v2.c+7 -31 reply
14/19iio: prox: as3935: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/proximity/as3935.c+7 -31 reply
15/19iio: magn: hmc5843: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/magnetometer/hmc5843.h drivers/iio/magnetometer/hmc5843_core.c+8 -40 replies
16/19iio: magn: bmc150: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/magnetometer/bmc150_magn.c+7 -43 replies
17/19iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/light/isl29125.c+7 -30 replies
18/19iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/light/tcs3414.c+7 -30 replies
19/19iio: light: tcs3472: Fix buffer alignment in iio_push_to_buffers_with_timestamp()drivers/iio/light/tcs3472.c+7 -31 reply

Reviews trailers per patch

3 of 19 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchAndy ShevchenkoLinus WalleijMatt Ranostay
SeriesR-b
1/19
2/19
3/19
4/19
5/19
6/19
7/19
8/19
9/19
10/19
11/19
12/19
13/19A-b
14/19A-b
15/19
16/19R-b
17/19
18/19
19/19

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v1 thread

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

From: Jonathan Cameron <[email protected]>

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 and clean them up.

As discussed previous in
https://lore.kernel.org/linux-iio/[email protected]/
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 <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Srinivas Pandruvada <[email protected]>
Cc Daniel Baluta <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Stefan-Gabriel Mirea <[email protected]>
Cc Sanchayan Maity <[email protected]>
Cc Stephan Gerhold <[email protected]>
Cc Andreas Klinger <[email protected]>
Cc Matt Ranostay <[email protected]>
Cc Linus Walleij <[email protected]>

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(-)
Signature · 1 line
2.31.1