All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Peter Meerwald <pmeerw@pmeerw.net>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Daniel Baluta <daniel.baluta@nxp.com>,
	Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>,
	Sanchayan Maity <maitysanchayan@gmail.com>,
	Stephan Gerhold <stephan@gerhold.net>,
	Andreas Klinger <ak@it-klinger.de>,
	Matt Ranostay <matt.ranostay@konsulko.com>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 00/19] IIO: Alignment fixes part 2 - struct used to ensure alignment
Date: Sat,  1 May 2021 18:01:02 +0100	[thread overview]
Message-ID: <20210501170121.512209-1-jic23@kernel.org> (raw)

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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/20200920112742.170751-1-jic23@kernel.org/
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@pmeerw.net>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Daniel Baluta <daniel.baluta@nxp.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Cc: Sanchayan Maity <maitysanchayan@gmail.com>
Cc: Stephan Gerhold <stephan@gerhold.net>
Cc: Andreas Klinger <ak@it-klinger.de>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
Cc: Linus Walleij <linus.walleij@linaro.org>

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


             reply	other threads:[~2021-05-01 17:02 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-01 17:01 Jonathan Cameron [this message]
2021-05-01 17:01 ` [PATCH 01/19] iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Jonathan Cameron
2021-05-13 17:22   ` Jonathan Cameron
2021-05-01 17:01 ` [PATCH 02/19] iio: accel: bma220: " Jonathan Cameron
2021-05-13 17:26   ` Jonathan Cameron
2021-05-01 17:01 ` [PATCH 03/19] iio: accel: hid: " Jonathan Cameron
2021-05-13 17:28   ` Jonathan Cameron
2021-05-01 17:01 ` [PATCH 04/19] iio: accel: kxcjk-1013: " Jonathan Cameron
2021-05-01 19:10   ` Andy Shevchenko
2021-05-13 17:33     ` Jonathan Cameron
2021-05-01 17:01 ` [PATCH 05/19] iio: accel: mxc4005: Fix overread of data and alignment issue Jonathan Cameron
2021-05-13 17:37   ` Jonathan Cameron
2021-05-01 17:01 ` [PATCH 06/19] iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp() Jonathan Cameron
2021-05-13 17:39   ` Jonathan Cameron
2021-05-01 17:01 ` [PATCH 07/19] iio: accel: stk8ba50: " Jonathan Cameron
2021-05-01 17:01 ` [PATCH 08/19] iio: adc: ti-ads1015: " Jonathan Cameron
2021-05-01 17:01 ` [PATCH 09/19] iio: adc: vf610: " Jonathan Cameron
2021-05-01 17:01 ` [PATCH 10/19] iio: gyro: bmg160: " Jonathan Cameron
2021-05-01 17:01 ` [PATCH 11/19] iio: humidity: am2315: " Jonathan Cameron
2021-05-01 17:01 ` [PATCH 12/19] iio: prox: srf08: " Jonathan Cameron
2021-05-01 17:01 ` [PATCH 13/19] iio: prox: pulsed-light: " Jonathan Cameron
2021-05-06  6:46   ` Matt Ranostay
2021-05-01 17:01 ` [PATCH 14/19] iio: prox: as3935: " Jonathan Cameron
2021-05-06  6:45   ` Matt Ranostay
2021-05-01 17:01 ` [PATCH 15/19] iio: magn: hmc5843: " Jonathan Cameron
2021-05-01 17:01 ` [PATCH 16/19] iio: magn: bmc150: " Jonathan Cameron
2021-05-05 12:57   ` Linus Walleij
2021-05-07  9:23     ` Jonathan Cameron
2021-05-13 17:50   ` Jonathan Cameron
2021-05-01 17:01 ` [PATCH 17/19] iio: light: isl29125: " Jonathan Cameron
2021-05-01 17:01 ` [PATCH 18/19] iio: light: tcs3414: " Jonathan Cameron
2021-05-01 17:01 ` [PATCH 19/19] iio: light: tcs3472: " Jonathan Cameron
2021-05-01 19:09   ` Andy Shevchenko
2021-05-01 19:12 ` [PATCH 00/19] IIO: Alignment fixes part 2 - struct used to ensure alignment Andy Shevchenko
2021-05-13 17:54   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210501170121.512209-1-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=ak@it-klinger.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=daniel.baluta@nxp.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=maitysanchayan@gmail.com \
    --cc=matt.ranostay@konsulko.com \
    --cc=pmeerw@pmeerw.net \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=stefan-gabriel.mirea@nxp.com \
    --cc=stephan@gerhold.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.