summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2025-04-13 11:34:36 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-05-18 08:21:24 +0200
commit35061dc5f64371124e2183e49277406dfe4121a0 (patch)
tree80ba23cb0b765022e21de6088e9cfa632015ea33
parent6f371b751be017ec1da2f2076aa1a9213a51dc74 (diff)
downloadlinux-35061dc5f64371124e2183e49277406dfe4121a0.tar.gz
linux-35061dc5f64371124e2183e49277406dfe4121a0.tar.bz2
linux-35061dc5f64371124e2183e49277406dfe4121a0.zip
iio: temp: maxim-thermocouple: Fix potential lack of DMA safe buffer.
[ Upstream commit f79aeb6c631b57395f37acbfbe59727e355a714c ] The trick of using __aligned(IIO_DMA_MINALIGN) ensures that there is no overlap between buffers used for DMA and those used for driver state storage that are before the marking. It doesn't ensure anything above state variables found after the marking. Hence move this particular bit of state earlier in the structure. Fixes: 10897f34309b ("iio: temp: maxim_thermocouple: Fix alignment for DMA safety") Reviewed-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20250413103443.2420727-14-jic23@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/iio/temperature/maxim_thermocouple.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/temperature/maxim_thermocouple.c b/drivers/iio/temperature/maxim_thermocouple.c
index c28a7a6dea5f..555a61e2f3fd 100644
--- a/drivers/iio/temperature/maxim_thermocouple.c
+++ b/drivers/iio/temperature/maxim_thermocouple.c
@@ -121,9 +121,9 @@ static const struct maxim_thermocouple_chip maxim_thermocouple_chips[] = {
struct maxim_thermocouple_data {
struct spi_device *spi;
const struct maxim_thermocouple_chip *chip;
+ char tc_type;
u8 buffer[16] __aligned(IIO_DMA_MINALIGN);
- char tc_type;
};
static int maxim_thermocouple_read(struct maxim_thermocouple_data *data,