IIO: Alignment fixes part 2 - struct used to ensure alignment
Subsystems (5)
Jonathan Cameron
maintainercover 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).
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
Jonathan Cameron
maintainerPATCH 1/19 iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/bma180.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/accel/bma180.c +7 -3
@@ -162,7 +162,11 @@ struct bma180_data {int scale;int bw;bool pmode; -u8 buff[16 ];/* 3x 16-bit + 8-bit + padding + timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +s16 chan[3 ]; +s64 timestamp__aligned(8) ; + } scan; };enum bma180_chan {
@@ -938,12 +942,12 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)mutex_unlock (&data->mutex); goto err; } - ((s16 *)data->buff)[i++] = ret; + data->scan.chan[i++] = ret; }mutex_unlock (&data->mutex); -iio_push_to_buffers_with_timestamp (indio_dev, data->buff, time_ns); +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, time_ns); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.31.1
Re: [PATCH 01/19] iio: accel: bma180: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Quoted 10 lines · On Sat, 1 May 2021 18:01:03 +0100 Jonathan Cameron <[email protected]> wrote:
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
Fixes b9a6a237ffc9 ("iio:bma180: Drop _update_scan_mode()")Signed-off-by Jonathan Cameron <[email protected]>Cc Peter Meerwald <[email protected]>
Applied to the togreg branch of iio.git with a minor fix.
Note I'm taking these the slow way and nor marking them for stable as they've been there a very long time.
Quoted 9 lines
--- drivers/iio/accel/bma180.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/iio/accel/bma180.c +0
-0
drivers/iio/accel/bma180.c struct bma180_data { · line 167
Quoted 7 lines
drivers/iio/accel/bma180.c +3
-1@@ -162,7 +162,11 @@ struct bma180_data {int scale;int bw;bool pmode; -u8 buff[16 ];/* 3x 16-bit + 8-bit + padding + timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +s16 chan[3 ];
The 8 bit in the comment above is misleading, but made me take another
look at this. There are actually 4 channels on some devices, the last
of which (temp) is 8 bits in a 16bit field.
I changed this to be s16 chan[4] to reflect that.
Thanks,
Jonathan
Quoted 20 lines
drivers/iio/accel/bma180.c +4
-2+s64 timestamp__aligned(8) ; + } scan; };enum bma180_chan {@@ -938,12 +942,12 @@ static irqreturn_t bma180_trigger_handler(int irq, void *p)mutex_unlock (&data->mutex); goto err; } - ((s16 *)data->buff)[i++] = ret; + data->scan.chan[i++] = ret; }mutex_unlock (&data->mutex); -iio_push_to_buffers_with_timestamp (indio_dev, data->buff, time_ns); +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, time_ns); err:iio_trigger_notify_done (indio_dev->trig);
Jonathan Cameron
maintainerPATCH 2/19 iio: accel: bma220: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/bma220_spi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/accel/bma220_spi.c +7 -3
@@ -63,7 +63,11 @@ static const int bma220_scale_table[][2] = {struct bma220_data {struct spi_device *spi_device;struct mutex lock; -s8 buffer[16 ];/* 3x8-bit channels + 5x8 padding + 8x8 timestamp */ +struct { +s8 chans[2 ]; +/* Ensure timestamp is naturally aligned. */ +s64 timestamp__aligned(8) ; + } scan;u8 tx_buf[2 ]____cacheline_aligned ; };
@@ -94,12 +98,12 @@ static irqreturn_t bma220_trigger_handler(int irq, void *p)mutex_lock (&data->lock); data->tx_buf[0 ] =BMA220_REG_ACCEL_X |BMA220_READ_MASK ; - ret =spi_write_then_read (spi, data->tx_buf,1 , data->buffer, + ret =spi_write_then_read (spi, data->tx_buf,1 , &data->scan.chans,ARRAY_SIZE (bma220_channels) -1 );if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:mutex_unlock (&data->lock);
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerRe: [PATCH 02/19] iio: accel: bma220: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Quoted 6 lines · On Sat, 1 May 2021 18:01:04 +0100 Jonathan Cameron <[email protected]> wrote:
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
~Gah. Clearly wasn't on my best form when I originally wrote these. Number of chans in this one is wrong as well. Fixed to 3 as per the comment that got dropped because it should have been obvious.
As you might imagine, the error in patch 1 made me look closer at the rest of these whilst applying.
Quoted 4 lines
Fixes 194dc4c71413 ("iio: accel: Add triggered buffer support for BMA220")Signed-off-by Jonathan Cameron <[email protected]>Cc Andy Shevchenko <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to poke at.
Thanks,
Jonathan
Quoted 36 lines
--- drivers/iio/accel/bma220_spi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/iio/accel/bma220_spi.c +7
-3@@ -63,7 +63,11 @@ static const int bma220_scale_table[][2] = {struct bma220_data {struct spi_device *spi_device;struct mutex lock; -s8 buffer[16 ];/* 3x8-bit channels + 5x8 padding + 8x8 timestamp */ +struct { +s8 chans[2 ]; +/* Ensure timestamp is naturally aligned. */ +s64 timestamp__aligned(8) ; + } scan;u8 tx_buf[2 ]____cacheline_aligned ; };@@ -94,12 +98,12 @@ static irqreturn_t bma220_trigger_handler(int irq, void *p)mutex_lock (&data->lock); data->tx_buf[0 ] =BMA220_REG_ACCEL_X |BMA220_READ_MASK ; - ret =spi_write_then_read (spi, data->tx_buf,1 , data->buffer, + ret =spi_write_then_read (spi, data->tx_buf,1 , &data->scan.chans,ARRAY_SIZE (bma220_channels) -1 );if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:mutex_unlock (&data->lock);
Jonathan Cameron
maintainerPATCH 3/19 iio: accel: hid: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Note this matches what was done in all the other hid sensor drivers. This one was missed previously due to an extra level of indirection.
Found during an audit of all calls of this function.
--- drivers/iio/accel/hid-sensor-accel-3d.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/iio/accel/hid-sensor-accel-3d.c +8 -5
@@ -28,8 +28,11 @@ struct accel_3d_state {struct hid_sensor_hub_callbacks callbacks;struct hid_sensor_common common_attributes;struct hid_sensor_hub_attribute_info accel[ACCEL_3D_CHANNEL_MAX ]; -/* Reserve for 3 channels + padding + timestamp */ -u32 accel_val[ACCEL_3D_CHANNEL_MAX +3 ]; +/* Ensure timestamp is naturally aligned */ +struct { +u32 accel_val[3 ]; +s64 timestamp__aligned(8) ; + } scan;int scale_pre_decml;int scale_post_decml;int scale_precision;
@@ -245,8 +248,8 @@ static int accel_3d_proc_event(struct hid_sensor_hub_device *hsdev, accel_state->timestamp =iio_get_time_ns (indio_dev);hid_sensor_push_data (indio_dev, - accel_state->accel_val, -sizeof (accel_state->accel_val), + &accel_state->scan, +sizeof (accel_state->scan), accel_state->timestamp); accel_state->timestamp =0 ;
@@ -271,7 +274,7 @@ static int accel_3d_capture_sample(struct hid_sensor_hub_device *hsdev,case HID_USAGE_SENSOR_ACCEL_Y_AXIS :case HID_USAGE_SENSOR_ACCEL_Z_AXIS : offset = usage_id -HID_USAGE_SENSOR_ACCEL_X_AXIS ; - accel_state->accel_val[CHANNEL_SCAN_INDEX_X + offset] = + accel_state->scan.accel_val[CHANNEL_SCAN_INDEX_X + offset] = *(u32 *)raw_data; ret =0 ;break ;
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerRe: [PATCH 03/19] iio: accel: hid: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Quoted 7 lines · On Sat, 1 May 2021 18:01:05 +0100 Jonathan Cameron <[email protected]> wrote:
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Note this matches what was done in all the other hid sensor drivers. This one was missed previously due to an extra level of indirection.
Quoted 5 lines
Found during an audit of all calls of this function.
Fixes a96cd0f901ee ("iio: accel: hid-sensor-accel-3d: Add timestamp")Signed-off-by Jonathan Cameron <[email protected]>Cc Srinivas Pandruvada <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to poke at.
Thanks,
Jonathan
Quoted 42 lines
--- drivers/iio/accel/hid-sensor-accel-3d.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)drivers/iio/accel/hid-sensor-accel-3d.c +8
-5@@ -28,8 +28,11 @@ struct accel_3d_state {struct hid_sensor_hub_callbacks callbacks;struct hid_sensor_common common_attributes;struct hid_sensor_hub_attribute_info accel[ACCEL_3D_CHANNEL_MAX ]; -/* Reserve for 3 channels + padding + timestamp */ -u32 accel_val[ACCEL_3D_CHANNEL_MAX +3 ]; +/* Ensure timestamp is naturally aligned */ +struct { +u32 accel_val[3 ]; +s64 timestamp__aligned(8) ; + } scan;int scale_pre_decml;int scale_post_decml;int scale_precision;@@ -245,8 +248,8 @@ static int accel_3d_proc_event(struct hid_sensor_hub_device *hsdev, accel_state->timestamp =iio_get_time_ns (indio_dev);hid_sensor_push_data (indio_dev, - accel_state->accel_val, -sizeof (accel_state->accel_val), + &accel_state->scan, +sizeof (accel_state->scan), accel_state->timestamp); accel_state->timestamp =0 ;@@ -271,7 +274,7 @@ static int accel_3d_capture_sample(struct hid_sensor_hub_device *hsdev,case HID_USAGE_SENSOR_ACCEL_Y_AXIS :case HID_USAGE_SENSOR_ACCEL_Z_AXIS : offset = usage_id -HID_USAGE_SENSOR_ACCEL_X_AXIS ; - accel_state->accel_val[CHANNEL_SCAN_INDEX_X + offset] = + accel_state->scan.accel_val[CHANNEL_SCAN_INDEX_X + offset] = *(u32 *)raw_data; ret =0 ;break ;
Jonathan Cameron
maintainerPATCH 4/19 iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/kxcjk-1013.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/iio/accel/kxcjk-1013.c +14 -10
@@ -133,6 +133,13 @@ enum kx_acpi_type { ACPI_KIOX010A, }; +enum kxcjk1013_axis { +AXIS_X , +AXIS_Y , +AXIS_Z , +AXIS_MAX , +}; +struct kxcjk1013_data {struct regulator_bulk_data regulators[2 ];struct i2c_client *client;
@@ -140,7 +147,11 @@ struct kxcjk1013_data {struct iio_trigger *motion_trig;struct iio_mount_matrix orientation;struct mutex mutex; -s16 buffer[8 ]; +/* Ensure timestamp naturally aligned */ +struct { +s16 chans[AXIS_MAX ]; +s64 timestamp__aligned(8) ; + } scan;u8 odr_bits;u8 range;int wake_thres;
@@ -154,13 +165,6 @@ struct kxcjk1013_data {enum kx_acpi_type acpi_type; }; -enum kxcjk1013_axis { -AXIS_X , -AXIS_Y , -AXIS_Z , -AXIS_MAX , -}; -enum kxcjk1013_mode {STANDBY ,OPERATION ,
@@ -1094,12 +1098,12 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p) ret =i2c_smbus_read_i2c_block_data_or_emulated (data->client,KXCJK1013_REG_XOUT_L ,AXIS_MAX *2 , - (u8 *)data->buffer); + (u8 *)data->scan.chans);mutex_unlock (&data->mutex);if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, data->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.31.1
Re: [PATCH 04/19] iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Quoted 20 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
Fixes 1a4fbf6a9286 ("iio: accel: kxcjk1013 3-axis accelerometer driver")Signed-off-by Jonathan Cameron <[email protected]>Cc Srinivas Pandruvada <[email protected]>--- drivers/iio/accel/kxcjk-1013.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)drivers/iio/accel/kxcjk-1013.c +0
-0
drivers/iio/accel/kxcjk-1013.c enum kx_acpi_type { · line 141
Quoted 9 lines
drivers/iio/accel/kxcjk-1013.c +5
-0@@ -133,6 +133,13 @@ enum kx_acpi_type { ACPI_KIOX010A, }; +enum kxcjk1013_axis { +AXIS_X , +AXIS_Y , +AXIS_Z , +AXIS_MAX ,
I see that this is from original code, though I think you have a chance to remove unneeded comma here. Let's make the terminator line terminate.
Quoted 50 lines
drivers/iio/accel/kxcjk-1013.c +2
-0+}; +struct kxcjk1013_data {struct regulator_bulk_data regulators[2 ];struct i2c_client *client;drivers/iio/accel/kxcjk-1013.c +7
-11@@ -140,7 +147,11 @@ struct kxcjk1013_data {struct iio_trigger *motion_trig;struct iio_mount_matrix orientation;struct mutex mutex; -s16 buffer[8 ]; +/* Ensure timestamp naturally aligned */ +struct { +s16 chans[AXIS_MAX ]; +s64 timestamp__aligned(8) ; + } scan;u8 odr_bits;u8 range;int wake_thres;@@ -154,13 +165,6 @@ struct kxcjk1013_data {enum kx_acpi_type acpi_type; }; -enum kxcjk1013_axis { -AXIS_X , -AXIS_Y , -AXIS_Z , -AXIS_MAX , -}; -enum kxcjk1013_mode {STANDBY ,OPERATION ,@@ -1094,12 +1098,12 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p) ret =i2c_smbus_read_i2c_block_data_or_emulated (data->client,KXCJK1013_REG_XOUT_L ,AXIS_MAX *2 , - (u8 *)data->buffer); + (u8 *)data->scan.chans);mutex_unlock (&data->mutex);if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, data->timestamp); err:iio_trigger_notify_done (indio_dev->trig); --2.31.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH 04/19] iio: accel: kxcjk-1013: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Quoted 29 lines · On Sat, 1 May 2021 22:10:48 +0300 Andy Shevchenko <[email protected]>…
Quoted 27 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
Fixes 1a4fbf6a9286 ("iio: accel: kxcjk1013 3-axis accelerometer driver")Signed-off-by Jonathan Cameron <[email protected]>Cc Srinivas Pandruvada <[email protected]>--- drivers/iio/accel/kxcjk-1013.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)drivers/iio/accel/kxcjk-1013.c +4
-0@@ -133,6 +133,13 @@ enum kx_acpi_type { ACPI_KIOX010A, }; +enum kxcjk1013_axis { +AXIS_X , +AXIS_Y , +AXIS_Z ,
Quoted 5 lines
drivers/iio/accel/kxcjk-1013.c enum kx_acpi_type { · line 140
Quoted 1 line
drivers/iio/accel/kxcjk-1013.c +1
-0+ AXIS_MAX,I see that this is from original code, though I think you have a chance to remove unneeded comma here. Let's make the terminator line terminate.
Good idea. Did that whilst applying. This one had a lot of fuzz due to support of new parts added to the driver in the meantime, but the patch seems to have applied cleanly.
+CC various people involved in that series so they know this change is going in as well (and can perhaps give it a spin!:)
Thanks,
Jonathan
Quoted 53 lines
Quoted 51 lines
drivers/iio/accel/kxcjk-1013.c +9
-11+}; +struct kxcjk1013_data {struct regulator_bulk_data regulators[2 ];struct i2c_client *client;@@ -140,7 +147,11 @@ struct kxcjk1013_data {struct iio_trigger *motion_trig;struct iio_mount_matrix orientation;struct mutex mutex; -s16 buffer[8 ]; +/* Ensure timestamp naturally aligned */ +struct { +s16 chans[AXIS_MAX ]; +s64 timestamp__aligned(8) ; + } scan;u8 odr_bits;u8 range;int wake_thres;@@ -154,13 +165,6 @@ struct kxcjk1013_data {enum kx_acpi_type acpi_type; }; -enum kxcjk1013_axis { -AXIS_X , -AXIS_Y , -AXIS_Z , -AXIS_MAX , -}; -enum kxcjk1013_mode {STANDBY ,OPERATION ,@@ -1094,12 +1098,12 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p) ret =i2c_smbus_read_i2c_block_data_or_emulated (data->client,KXCJK1013_REG_XOUT_L ,AXIS_MAX *2 , - (u8 *)data->buffer); + (u8 *)data->scan.chans);mutex_unlock (&data->mutex);if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, data->timestamp); err:iio_trigger_notify_done (indio_dev->trig); --2.31.1
Jonathan Cameron
maintainerPATCH 5/19 iio: accel: mxc4005: Fix overread of data and alignment issue.
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
The bulk read size is based on the size of an array that also has space for the timestamp alongside the channels.
Fix that and also fix alignment of the buffer passed
to iio_push_to_buffers_with_timestamp.
Found during an audit of all calls to this function.
--- drivers/iio/accel/mxc4005.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/accel/mxc4005.c +7 -3
@@ -56,7 +56,11 @@ struct mxc4005_data {struct mutex mutex;struct regmap *regmap;struct iio_trigger *dready_trig; -__be16 buffer[8 ]; +/* Ensure timestamp is naturally aligned */ +struct { +__be16 chans[3 ]; +s64 timestamp; + } scan;bool trigger_enabled; };
@@ -135,7 +139,7 @@ static int mxc4005_read_xyz(struct mxc4005_data *data)int ret; ret =regmap_bulk_read (data->regmap,MXC4005_REG_XOUT_UPPER , - data->buffer,sizeof (data->buffer)); + data->scan.chans,sizeof (data->scan.chans));if (ret <0 ) {dev_err (data->dev,"failed to read axes\n" );return ret;
@@ -301,7 +305,7 @@ static irqreturn_t mxc4005_trigger_handler(int irq, void *private)if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerRe: [PATCH 05/19] iio: accel: mxc4005: Fix overread of data and alignment issue.
Quoted 11 lines · On Sat, 1 May 2021 18:01:07 +0100 Jonathan Cameron <[email protected]> wrote:
From: Jonathan Cameron <[email protected]>
The bulk read size is based on the size of an array that also has space for the timestamp alongside the channels.
Fix that and also fix alignment of the buffer passed
toiio_push_to_buffers_with_timestamp.Found during an audit of all calls to this function.
Fixes 1ce0eda0f757 ("iio: mxc4005: add triggered buffer mode for mxc4005")Signed-off-by Jonathan Cameron <[email protected]>
Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to see if they can find anything. Minor tweak to enforce the 8 byte alignment as done in other drivers.
Quoted 9 lines
--- drivers/iio/accel/mxc4005.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/iio/accel/mxc4005.c +0
-0
drivers/iio/accel/mxc4005.c struct mxc4005_data { · line 62
Quoted 8 lines
drivers/iio/accel/mxc4005.c +4
-1@@ -56,7 +56,11 @@ struct mxc4005_data {struct mutex mutex;struct regmap *regmap;struct iio_trigger *dready_trig; -__be16 buffer[8 ]; +/* Ensure timestamp is naturally aligned */ +struct { +__be16 chans[3 ]; +s64 timestamp;
Added __aligned(8) here to be consistent and ensure natural alignment.
Quoted 22 lines
drivers/iio/accel/mxc4005.c +3
-2+ } scan;bool trigger_enabled; };@@ -135,7 +139,7 @@ static int mxc4005_read_xyz(struct mxc4005_data *data)int ret; ret =regmap_bulk_read (data->regmap,MXC4005_REG_XOUT_UPPER , - data->buffer,sizeof (data->buffer)); + data->scan.chans,sizeof (data->scan.chans));if (ret <0 ) {dev_err (data->dev,"failed to read axes\n" );return ret;@@ -301,7 +305,7 @@ static irqreturn_t mxc4005_trigger_handler(int irq, void *private)if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:
Jonathan Cameron
maintainerPATCH 6/19 iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/stk8312.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/iio/accel/stk8312.c +8 -4
@@ -103,7 +103,11 @@ struct stk8312_data {u8 mode;struct iio_trigger *dready_trig;bool dready_trigger_on; -s8 buffer[16 ];/* 3x8-bit channels + 5x8 padding + 64-bit timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +s8 chans[3 ]; +s64 timestamp; + } scan; }; static IIO_CONST_ATTR(in_accel_scale_available, STK8312_SCALE_AVAIL);
@@ -438,7 +442,7 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p) ret =i2c_smbus_read_i2c_block_data (data->client,STK8312_REG_XOUT ,STK8312_ALL_CHANNEL_SIZE , - data->buffer); + data->scan.chans);if (ret <STK8312_ALL_CHANNEL_SIZE ) {dev_err (&data->client->dev,"register read failed\n" );mutex_unlock (&data->lock);
@@ -452,12 +456,12 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p)mutex_unlock (&data->lock); goto err; } - data->buffer[i++] = ret; + data->scan.chans[i++] = ret; } }mutex_unlock (&data->lock); -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerRe: [PATCH 06/19] iio: accel: stk8312: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Quoted 9 lines · On Sat, 1 May 2021 18:01:08 +0100 Jonathan Cameron <[email protected]> wrote:
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
Fixes 95c12bba51c3 ("iio: accel: Add buffer mode for Sensortek STK8312")Signed-off-by Jonathan Cameron <[email protected]>
Also missing the __aligned(8) for the timestamp. Added it.
thanks,
Jonathan
Quoted 45 lines
--- drivers/iio/accel/stk8312.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)drivers/iio/accel/stk8312.c +8
-4@@ -103,7 +103,11 @@ struct stk8312_data {u8 mode;struct iio_trigger *dready_trig;bool dready_trigger_on; -s8 buffer[16 ];/* 3x8-bit channels + 5x8 padding + 64-bit timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +s8 chans[3 ]; +s64 timestamp; + } scan; }; static IIO_CONST_ATTR(in_accel_scale_available, STK8312_SCALE_AVAIL);@@ -438,7 +442,7 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p) ret =i2c_smbus_read_i2c_block_data (data->client,STK8312_REG_XOUT ,STK8312_ALL_CHANNEL_SIZE , - data->buffer); + data->scan.chans);if (ret <STK8312_ALL_CHANNEL_SIZE ) {dev_err (&data->client->dev,"register read failed\n" );mutex_unlock (&data->lock);@@ -452,12 +456,12 @@ static irqreturn_t stk8312_trigger_handler(int irq, void *p)mutex_unlock (&data->lock); goto err; } - data->buffer[i++] = ret; + data->scan.chans[i++] = ret; } }mutex_unlock (&data->lock); -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Jonathan Cameron
maintainerPATCH 7/19 iio: accel: stk8ba50: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/accel/stk8ba50.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/iio/accel/stk8ba50.c +8 -9
@@ -91,12 +91,11 @@ struct stk8ba50_data {u8 sample_rate_idx;struct iio_trigger *dready_trig;bool dready_trigger_on; -/* -* 3 x 16-bit channels (10-bit data, 6-bit padding) + -* 1 x 16 padding + -* 4 x 16 64-bit timestamp -*/ -s16 buffer[8 ]; +/* Ensure timestamp is naturally aligned */ +struct { +s16 chans[3 ]; +s64 timetamp__aligned(8) ; + } scan; };#define STK8BA50_ACCEL_CHANNEL (index, reg, axis) { \
@@ -324,7 +323,7 @@ static irqreturn_t stk8ba50_trigger_handler(int irq, void *p) ret =i2c_smbus_read_i2c_block_data (data->client,STK8BA50_REG_XOUT ,STK8BA50_ALL_CHANNEL_SIZE , - (u8 *)data->buffer); + (u8 *)data->scan.chans);if (ret <STK8BA50_ALL_CHANNEL_SIZE ) {dev_err (&data->client->dev,"register read failed\n" ); goto err;
@@ -337,10 +336,10 @@ static irqreturn_t stk8ba50_trigger_handler(int irq, void *p)if (ret <0 ) goto err; - data->buffer[i++] = ret; + data->scan.chans[i++] = ret; } } -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:mutex_unlock (&data->lock);
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerPATCH 8/19 iio: adc: ti-ads1015: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of this function.
--- drivers/iio/adc/ti-ads1015.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/iio/adc/ti-ads1015.c +8 -4
@@ -395,10 +395,14 @@ static irqreturn_t ads1015_trigger_handler(int irq, void *p)struct iio_poll_func *pf = p;struct iio_dev *indio_dev = pf->indio_dev;struct ads1015_data *data =iio_priv (indio_dev); -s16 buf[8 ];/* 1x s16 ADC val + 3x s16 padding + 4x s16 timestamp */ +/* Ensure natural alignment of timestamp */ +struct { +s16 chan; +s64 timestamp__aligned(8) ; + } scan;int chan, ret, res; -memset (buf,0 ,sizeof (buf)); +memset (&scan,0 ,sizeof (scan));mutex_lock (&data->lock); chan = find_first_bit(indio_dev->active_scan_mask,
@@ -409,10 +413,10 @@ static irqreturn_t ads1015_trigger_handler(int irq, void *p) goto err; } - buf[0 ] = res; + scan.chan = res;mutex_unlock (&data->lock); -iio_push_to_buffers_with_timestamp (indio_dev, buf, +iio_push_to_buffers_with_timestamp (indio_dev, &scan,iio_get_time_ns (indio_dev)); err:
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerPATCH 9/19 iio: adc: vf610: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/adc/vf610_adc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/adc/vf610_adc.c +7 -3
@@ -167,7 +167,11 @@ struct vf610_adc {u32 sample_freq_avail[5 ];struct completion completion; -u16 buffer[8 ]; +/* Ensure the timestamp is naturally aligned */ +struct { +u16 chan; +s64 timestamp__aligned(8) ; + } scan; };static const u32 vf610_hw_avgs[] = {1 ,4 ,8 ,16 ,32 };
@@ -579,9 +583,9 @@ static irqreturn_t vf610_adc_isr(int irq, void *dev_id)if (coco &VF610_ADC_HS_COCO0 ) { info->value =vf610_adc_read_data (info);if (iio_buffer_enabled (indio_dev)) { - info->buffer[0 ] = info->value; + info->scan.chan = info->value;iio_push_to_buffers_with_timestamp (indio_dev, - info->buffer, + &info->scan,iio_get_time_ns (indio_dev));iio_trigger_notify_done (indio_dev->trig); }else
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerPATCH 10/19 iio: gyro: bmg160: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/gyro/bmg160_core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/gyro/bmg160_core.c +7 -3
@@ -98,7 +98,11 @@ struct bmg160_data {struct iio_trigger *motion_trig;struct iio_mount_matrix orientation;struct mutex mutex; -s16 buffer[8 ]; +/* Ensure naturally aligned timestamp */ +struct { +s16 chans[3 ]; +s64 timestamp__aligned(8) ; + } scan;u32 dps_range;int ev_enable_state;int slope_thres;
@@ -882,12 +886,12 @@ static irqreturn_t bmg160_trigger_handler(int irq, void *p)mutex_lock (&data->mutex); ret =regmap_bulk_read (data->regmap,BMG160_REG_XOUT_L , - data->buffer,AXIS_MAX *2 ); + data->scan.chans,AXIS_MAX *2 );mutex_unlock (&data->mutex);if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerPATCH 11/19 iio: humidity: am2315: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/humidity/am2315.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/iio/humidity/am2315.c +10 -6
@@ -33,7 +33,11 @@struct am2315_data {struct i2c_client *client;struct mutex lock; -s16 buffer[8 ];/* 2x16-bit channels + 2x16 padding + 4x16 timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +s16 chans[2 ]; +s64 timestamp__aligned(8) ; + } scan; };struct am2315_sensor_data {
@@ -167,20 +171,20 @@ static irqreturn_t am2315_trigger_handler(int irq, void *p)mutex_lock (&data->lock);if (*(indio_dev->active_scan_mask) ==AM2315_ALL_CHANNEL_MASK ) { - data->buffer[0 ] = sensor_data.hum_data; - data->buffer[1 ] = sensor_data.temp_data; + data->scan.chans[0 ] = sensor_data.hum_data; + data->scan.chans[1 ] = sensor_data.temp_data; }else { i =0 ;for_each_set_bit (bit, indio_dev->active_scan_mask, indio_dev->masklength) { - data->buffer[i] = (bit ? sensor_data.temp_data : - sensor_data.hum_data); + data->scan.chans[i] = (bit ? sensor_data.temp_data : + sensor_data.hum_data); i++; } }mutex_unlock (&data->lock); -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerPATCH 12/19 iio: prox: srf08: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/proximity/srf08.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/iio/proximity/srf08.c +7 -7
@@ -63,11 +63,11 @@ struct srf08_data {int range_mm;struct mutex lock; -/* -* triggered buffer -* 1x16-bit channel + 3x16 padding + 4x16 timestamp -*/ -s16 buffer[8 ]; +/* Ensure timestamp is naturally aligned */ +struct { +s16 chan; +s64 timestamp__aligned(8) ; + } scan;/* Sensor-Type */ enum srf08_sensor_type sensor_type;
@@ -190,9 +190,9 @@ static irqreturn_t srf08_trigger_handler(int irq, void *p)mutex_lock (&data->lock); - data->buffer[0 ] = sensor_data; + data->scan.chan = sensor_data;iio_push_to_buffers_with_timestamp (indio_dev, - data->buffer, pf->timestamp); + &data->scan, pf->timestamp);mutex_unlock (&data->lock); err:
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerPATCH 13/19 iio: prox: pulsed-light: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +7 -3
@@ -44,7 +44,11 @@ struct lidar_data {int (*xfer)(struct lidar_data *data,u8 reg,u8 *val,int len);int i2c_enabled; -u16 buffer[8 ];/* 2 byte distance + 8 byte timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chan; +s64 timestamp__aligned(8) ; + } scan; };static const struct iio_chan_spec lidar_channels[] = {
@@ -229,9 +233,9 @@ static irqreturn_t lidar_trigger_handler(int irq, void *private)struct lidar_data *data =iio_priv (indio_dev);int ret; - ret =lidar_get_measurement (data, data->buffer); + ret =lidar_get_measurement (data, &data->scan.chan);if (!ret) { -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); }else if (ret != -EINVAL ) {dev_err (&data->client->dev,"cannot read LIDAR measurement" );
Signature · 1 line
2.31.1
Re: [PATCH 13/19] iio: prox: pulsed-light: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Quoted 11 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses of
iio_push_to_buffers_with_timestamp()Fixes cb119d535083 ("iio: proximity: add support for PulsedLight LIDAR")Signed-off-by Jonathan Cameron <[email protected]>
Quoted 37 lines
Cc Matt Ranostay <[email protected]>--- drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +7
-4@@ -44,7 +44,11 @@ struct lidar_data {int (*xfer)(struct lidar_data *data,u8 reg,u8 *val,int len);int i2c_enabled; -u16 buffer[8 ];/* 2 byte distance + 8 byte timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chan; +s64 timestamp__aligned(8) ; + } scan; };static const struct iio_chan_spec lidar_channels[] = {@@ -229,9 +233,9 @@ static irqreturn_t lidar_trigger_handler(int irq, void *private)struct lidar_data *data =iio_priv (indio_dev);int ret; - ret =lidar_get_measurement (data, data->buffer); + ret =lidar_get_measurement (data, &data->scan.chan);if (!ret) { -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); }else if (ret != -EINVAL ) {dev_err (&data->client->dev,"cannot read LIDAR measurement" ); --2.31.1
Jonathan Cameron
maintainerPATCH 14/19 iio: prox: as3935: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/proximity/as3935.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/proximity/as3935.c +7 -3
@@ -59,7 +59,11 @@ struct as3935_state {unsigned long noise_tripped;u32 tune_cap;u32 nflwdth_reg; -u8 buffer[16 ];/* 8-bit data + 56-bit padding + 64-bit timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u8 chan; +s64 timestamp__aligned(8) ; + } scan;u8 buf[2 ]____cacheline_aligned ; };
@@ -225,8 +229,8 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private)if (ret) goto err_read; - st->buffer[0 ] = val &AS3935_DATA_MASK ; -iio_push_to_buffers_with_timestamp (indio_dev, &st->buffer, + st->scan.chan = val &AS3935_DATA_MASK ; +iio_push_to_buffers_with_timestamp (indio_dev, &st->scan,iio_get_time_ns (indio_dev)); err_read:iio_trigger_notify_done (indio_dev->trig);
Signature · 1 line
2.31.1
Re: [PATCH 14/19] iio: prox: as3935: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Quoted 11 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses of
iio_push_to_buffers_with_timestamp()Fixes 37b1ba2c68cf ("iio: proximity: as3935: fix buffer stack trashing")Signed-off-by Jonathan Cameron <[email protected]>
Quoted 36 lines
Cc Matt Ranostay <[email protected]>--- drivers/iio/proximity/as3935.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/iio/proximity/as3935.c +7
-4@@ -59,7 +59,11 @@ struct as3935_state {unsigned long noise_tripped;u32 tune_cap;u32 nflwdth_reg; -u8 buffer[16 ];/* 8-bit data + 56-bit padding + 64-bit timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u8 chan; +s64 timestamp__aligned(8) ; + } scan;u8 buf[2 ]____cacheline_aligned ; };@@ -225,8 +229,8 @@ static irqreturn_t as3935_trigger_handler(int irq, void *private)if (ret) goto err_read; - st->buffer[0 ] = val &AS3935_DATA_MASK ; -iio_push_to_buffers_with_timestamp (indio_dev, &st->buffer, + st->scan.chan = val &AS3935_DATA_MASK ; +iio_push_to_buffers_with_timestamp (indio_dev, &st->scan,iio_get_time_ns (indio_dev)); err_read:iio_trigger_notify_done (indio_dev->trig); --2.31.1
Jonathan Cameron
maintainerPATCH 15/19 iio: magn: hmc5843: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/magnetometer/hmc5843.h | 8 ++++++-- drivers/iio/magnetometer/hmc5843_core.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/iio/magnetometer/hmc5843.h +6 -2
@@ -33,7 +33,8 @@ enum hmc5843_ids {* @lock: update and read regmap data * @regmap: hardware access register maps * @variant: describe chip variants -* @buffer: 3x 16-bit channels + padding + 64-bit timestamp +* @scan: buffer to pack data for passing to +* iio_push_to_buffers_with_timestamp() */ struct hmc5843_data {struct device *dev;
@@ -41,7 +42,10 @@ struct hmc5843_data {struct regmap *regmap;const struct hmc5843_chip_info *variant;struct iio_mount_matrix orientation; -__be16 buffer[8 ]; +struct { +__be16 chans[3 ]; +s64 timestamp__aligned(8) ; + } scan; }; int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
drivers/iio/magnetometer/hmc5843_core.c +2 -2
@@ -446,13 +446,13 @@ static irqreturn_t hmc5843_trigger_handler(int irq, void *p) } ret =regmap_bulk_read (data->regmap,HMC5843_DATA_OUT_MSB_REGS , - data->buffer,3 *sizeof (__be16)); + data->scan.chans,sizeof (data->scan.chans));mutex_unlock (&data->lock);if (ret <0 ) goto done; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); done:
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerPATCH 16/19 iio: magn: bmc150: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/magnetometer/bmc150_magn.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/iio/magnetometer/bmc150_magn.c +7 -4
@@ -138,8 +138,11 @@ struct bmc150_magn_data {struct regmap *regmap;struct regulator_bulk_data regulators[2 ];struct iio_mount_matrix orientation; -/* 4 x 32 bits for x, y z, 4 bytes align, 64 bits timestamp */ -s32 buffer[6 ]; +/* Ensure timestamp is naturally aligned */ +struct { +s32 chans[4 ]; +s64 timestamp__aligned(8) ; + } scan;struct iio_trigger *dready_trig;bool dready_trigger_on;int max_odr;
@@ -675,11 +678,11 @@ static irqreturn_t bmc150_magn_trigger_handler(int irq, void *p)int ret;mutex_lock (&data->mutex); - ret =bmc150_magn_read_xyz (data, data->buffer); + ret =bmc150_magn_read_xyz (data, data->scan.chans);if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:
Signature · 1 line
2.31.1
Re: [PATCH 16/19] iio: magn: bmc150: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Quoted 5 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Quoted 7 lines
Found during an audit of all calls of uses of
iio_push_to_buffers_with_timestamp()Fixes c91746a2361d ("iio: magn: Add support for BMC150 magnetometer")Signed-off-by Jonathan Cameron <[email protected]>Cc Stephan Gerhold <[email protected]>Cc Linus Walleij <[email protected]>
Excellent work Jonathan.
I wonder if there is some way for us to abstract this into the core so we can't get it wrong.
Yours,
Linus Walleij
Re: [PATCH 16/19] iio: magn: bmc150: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Quoted 15 lines · On Wed, 5 May 2021 14:57:12 +0200 Linus Walleij <[email protected]>…
Quoted 5 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Quoted 7 lines
Found during an audit of all calls of uses of
iio_push_to_buffers_with_timestamp()Fixes c91746a2361d ("iio: magn: Add support for BMC150 magnetometer")Signed-off-by Jonathan Cameron <[email protected]>Cc Stephan Gerhold <[email protected]>Cc Linus Walleij <[email protected]>
Quoted 5 lines
Excellent work Jonathan.
Reviewed-by Linus Walleij <[email protected]>I wonder if there is some way for us to abstract this into the core so we can't get it wrong.
Abstracting is a bit of a pain, because we end up creating unnecessary limitations on what can be done. Often having buffer a lot larger than it needs to be is sensible for example...
However, I'm definitely thinking we should look at what checks we can add once all these cases are fixed and there might be a nice pattern to use for those cases where we currently have a bounce buffer anyway due to hardware restrictions. In most others, moving to the pattern where the timestamp is explicit in the structure makes it obvious (subject to the fun question of x86_32 alignment and whether that matters - we don't know of any bugs as a result but it's possible some buffer consumer will assume 8 byte alignment - hence the hardening in these cases).
The size being too small case for example should be easy - we just augment iio_push_to_buffers_with_timestamp() to take the size and check it against scan_bytes. Alignment is trickier...
Jonathan
Quoted 2 lines
Yours,
Linus Walleij
Re: [PATCH 16/19] iio: magn: bmc150: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronQuoted 5 lines · On Sat, 1 May 2021 18:01:18 +0100 Jonathan Cameron <[email protected]> wrote:
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Quoted 7 lines
Found during an audit of all calls of uses of
iio_push_to_buffers_with_timestamp()Fixes c91746a2361d ("iio: magn: Add support for BMC150 magnetometer")Signed-off-by Jonathan Cameron <[email protected]>Cc Stephan Gerhold <[email protected]>Cc Linus Walleij <[email protected]>
Applied, but with a tiny tweak to make this more obviously correct.
Quoted 9 lines
--- drivers/iio/magnetometer/bmc150_magn.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)drivers/iio/magnetometer/bmc150_magn.c +0
-0
drivers/iio/magnetometer/bmc150_magn.c struct bmc150_magn_data { · line 143
Quoted 8 lines
drivers/iio/magnetometer/bmc150_magn.c +3
-2@@ -138,8 +138,11 @@ struct bmc150_magn_data {struct regmap *regmap;struct regulator_bulk_data regulators[2 ];struct iio_mount_matrix orientation; -/* 4 x 32 bits for x, y z, 4 bytes align, 64 bits timestamp */ -s32 buffer[6 ]; +/* Ensure timestamp is naturally aligned */ +struct { +s32 chans[4 ];
The whole point of the structure is to enforce the alignment without needing
to specify padding. There are only 3 actual chans, so I've reduced this to
s32 chans[3]
Result is exactly the same in practice, but it's more readable.
Thanks,
Jonathan
Quoted 19 lines
drivers/iio/magnetometer/bmc150_magn.c +4
-2+s64 timestamp__aligned(8) ; + } scan;struct iio_trigger *dready_trig;bool dready_trigger_on;int max_odr;@@ -675,11 +678,11 @@ static irqreturn_t bmc150_magn_trigger_handler(int irq, void *p)int ret;mutex_lock (&data->mutex); - ret =bmc150_magn_read_xyz (data, data->buffer); + ret =bmc150_magn_read_xyz (data, data->scan.chans);if (ret <0 ) goto err; -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan, pf->timestamp); err:
Jonathan Cameron
maintainerPATCH 17/19 iio: light: isl29125: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/light/isl29125.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/light/isl29125.c +7 -3
@@ -51,7 +51,11 @@struct isl29125_data {struct i2c_client *client;u8 conf1; -u16 buffer[8 ];/* 3x 16-bit, padding, 8 bytes timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chans[3 ]; +s64 timestamp__aligned(8) ; + } scan; };#define ISL29125_CHANNEL (_color, _si) { \
@@ -184,10 +188,10 @@ static irqreturn_t isl29125_trigger_handler(int irq, void *p)if (ret <0 ) goto done; - data->buffer[j++] = ret; + data->scan.chans[j++] = ret; } -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); done:
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerPATCH 18/19 iio: light: tcs3414: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
--- drivers/iio/light/tcs3414.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/light/tcs3414.c +7 -3
@@ -53,7 +53,11 @@ struct tcs3414_data {u8 control;u8 gain;u8 timing; -u16 buffer[8 ];/* 4x 16-bit + 8 bytes timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chans[4 ]; +s64 timestamp__aligned(8) ; + } scan; };#define TCS3414_CHANNEL (_color, _si, _addr) { \
@@ -209,10 +213,10 @@ static irqreturn_t tcs3414_trigger_handler(int irq, void *p)if (ret <0 ) goto done; - data->buffer[j++] = ret; + data->scan.chans[j++] = ret; } -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); done:
Signature · 1 line
2.31.1
Jonathan Cameron
maintainerPATCH 19/19 iio: light: tcs3472: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
In reply to Jonathan CameronFrom: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses ofiio_push_to_buffers_with_timestamp()
Fixes tag is not strictly accurate as prior to that patch there was potentially an unaligned write. However, any backport past there will need to be done manually.
--- drivers/iio/light/tcs3472.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/iio/light/tcs3472.c +7 -3
@@ -64,7 +64,11 @@ struct tcs3472_data {u8 control;u8 atime;u8 apers; -u16 buffer[8 ];/* 4 16-bit channels + 64-bit timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chans[4 ]; +s64 timestamp__aligned(8) ; + } scan; };static const struct iio_event_spec tcs3472_events[] = {
@@ -386,10 +390,10 @@ static irqreturn_t tcs3472_trigger_handler(int irq, void *p)if (ret <0 ) goto done; - data->buffer[j++] = ret; + data->scan.chans[j++] = ret; } -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); done:
Signature · 1 line
2.31.1
Re: [PATCH 19/19] iio: light: tcs3472: Fix buffer alignment in iio_push_to_buffers_with_timestamp()
Quoted 8 lines · Jonathan Cameron
From: Jonathan Cameron <[email protected]>
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned.
Found during an audit of all calls of uses of
iio_push_to_buffers_with_timestamp()
Missed period at the end of the line.
Quoted 43 lines
Fixes tag is not strictly accurate as prior to that patch there was potentially an unaligned write. However, any backport past there will need to be done manually.
Fixes 0624bf847dd0 ("iio:tcs3472: Use iio_push_to_buffers_with_timestamp()")Signed-off-by Jonathan Cameron <[email protected]>--- drivers/iio/light/tcs3472.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)drivers/iio/light/tcs3472.c +7
-4@@ -64,7 +64,11 @@ struct tcs3472_data {u8 control;u8 atime;u8 apers; -u16 buffer[8 ];/* 4 16-bit channels + 64-bit timestamp */ +/* Ensure timestamp is naturally aligned */ +struct { +u16 chans[4 ]; +s64 timestamp__aligned(8) ; + } scan; };static const struct iio_event_spec tcs3472_events[] = {@@ -386,10 +390,10 @@ static irqreturn_t tcs3472_trigger_handler(int irq, void *p)if (ret <0 ) goto done; - data->buffer[j++] = ret; + data->scan.chans[j++] = ret; } -iio_push_to_buffers_with_timestamp (indio_dev, data->buffer, +iio_push_to_buffers_with_timestamp (indio_dev, &data->scan,iio_get_time_ns (indio_dev)); done: --2.31.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 11 lines · Jonathan Cameron
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
Unfortunately
Quoted 14 lines
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).
Quoted 3 lines
Cc Peter Meerwald <[email protected]>Cc Andy Shevchenko <[email protected]>
1
Quoted 4 lines
Cc Srinivas Pandruvada <[email protected]>Cc Daniel Baluta <[email protected]>Cc Andy Shevchenko <[email protected]>
2
One time is enough :-)
Anyway, I looked at them all and haven't seen any issues on the first glance, so
Quoted 71 lines
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(-)--
2.31.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerQuoted 38 lines · On Sat, 1 May 2021 22:12:40 +0300 Andy Shevchenko <[email protected]>…
Quoted 11 lines · Jonathan Cameron
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
Unfortunately
Quoted 14 lines
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).
Quoted 3 lines
Cc Peter Meerwald <[email protected]>Cc Andy Shevchenko <[email protected]>1
Quoted 2 lines
Cc Srinivas Pandruvada <[email protected]>Cc Daniel Baluta <[email protected]>
Quoted 8 lines
Quoted 1 line
Cc Andy Shevchenko <[email protected]>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 <[email protected]>
Thanks. Whole series applied though seems I was being more than a bit careless in some of the early ones so I took a very close look at all them whilst applying.
Do too many similar patches, and mistakes slip in :(
Thanks,
Jonathan
Quoted 74 lines
Quoted 72 lines
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(-)--
2.31.1