diff mbox series

[v2,02/20] iio: adc: ad7768-1: Fix insufficient alignment of timestamp.

Message ID 20250406172001.2167607-3-jic23@kernel.org (mailing list archive)
State New
Headers show
Series IIO: Introduce iio_push_to_buffers_with_ts() taking an input buffer length argument. | expand

Commit Message

Jonathan Cameron April 6, 2025, 5:19 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

On architectures where an s64 is not 64 bit aligned, this may
result insufficient alignment of the timestamp and the structure
being too small. Use aligned_s64 to force the alignment.

Fixes: a1caeebab07e ("iio: adc: ad7768-1: Fix too small buffer passed to iio_push_to_buffers_with_timestamp()") # aligned_s64 newer
Reported-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/ad7768-1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andy Shevchenko April 7, 2025, 9:16 a.m. UTC | #1
On Sun, Apr 06, 2025 at 06:19:43PM +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> On architectures where an s64 is not 64 bit aligned, this may

64-bit

> result insufficient alignment of the timestamp and the structure
> being too small. Use aligned_s64 to force the alignment.
Nuno Sá April 7, 2025, 4:23 p.m. UTC | #2
On Sun, 2025-04-06 at 18:19 +0100, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> On architectures where an s64 is not 64 bit aligned, this may
> result insufficient alignment of the timestamp and the structure
> being too small. Use aligned_s64 to force the alignment.
> 
> Fixes: a1caeebab07e ("iio: adc: ad7768-1: Fix too small buffer passed to
> iio_push_to_buffers_with_timestamp()") # aligned_s64 newer
> Reported-by: David Lechner <dlechner@baylibre.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---

Reviewed-by: Nuno Sá <nuno.sa@analog.com>

>  drivers/iio/adc/ad7768-1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c
> index 5a863005aca6..5e0be36af0c5 100644
> --- a/drivers/iio/adc/ad7768-1.c
> +++ b/drivers/iio/adc/ad7768-1.c
> @@ -168,7 +168,7 @@ struct ad7768_state {
>  	union {
>  		struct {
>  			__be32 chan;
> -			s64 timestamp;
> +			aligned_s64 timestamp;
>  		} scan;
>  		__be32 d32;
>  		u8 d8[2];
diff mbox series

Patch

diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c
index 5a863005aca6..5e0be36af0c5 100644
--- a/drivers/iio/adc/ad7768-1.c
+++ b/drivers/iio/adc/ad7768-1.c
@@ -168,7 +168,7 @@  struct ad7768_state {
 	union {
 		struct {
 			__be32 chan;
-			s64 timestamp;
+			aligned_s64 timestamp;
 		} scan;
 		__be32 d32;
 		u8 d8[2];