| From d0420f0af1cd8847d837107b45cd095b45d0fdfc Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Sun, 13 Apr 2025 11:34:24 +0100 |
| Subject: iio: adc: ad7266: Fix potential timestamp alignment issue. |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| From: Jonathan Cameron <Jonathan.Cameron@huawei.com> |
| |
| [ Upstream commit 52d349884738c346961e153f195f4c7fe186fcf4 ] |
| |
| On architectures where an s64 is only 32-bit aligned insufficient padding |
| would be left between the earlier elements and the timestamp. Use |
| aligned_s64 to enforce the correct placement and ensure the storage is |
| large enough. |
| |
| Fixes: 54e018da3141 ("iio:ad7266: Mark transfer buffer as __be16") # aligned_s64 is much newer. |
| Reported-by: David Lechner <dlechner@baylibre.com> |
| Reviewed-by: Nuno Sรก <nuno.sa@analog.com> |
| Reviewed-by: David Lechner <dlechner@baylibre.com> |
| Link: https://patch.msgid.link/20250413103443.2420727-2-jic23@kernel.org |
| Cc: <Stable@vger.kernel.org> |
| Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/iio/adc/ad7266.c | 2 +- |
| 1 file changed, 1 insertion(+), 1 deletion(-) |
| |
| diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c |
| index 98648c679a55c..2ace3aafe4978 100644 |
| --- a/drivers/iio/adc/ad7266.c |
| +++ b/drivers/iio/adc/ad7266.c |
| @@ -44,7 +44,7 @@ struct ad7266_state { |
| */ |
| struct { |
| __be16 sample[2]; |
| - s64 timestamp; |
| + aligned_s64 timestamp; |
| } data __aligned(IIO_DMA_MINALIGN); |
| }; |
| |
| -- |
| 2.39.5 |
| |