[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190608113950.8033-1-sashal@kernel.org>
Date: Sat, 8 Jun 2019 07:38:40 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Vincent Stehlé <vincent.stehle@...oste.net>,
Mukesh Ojha <mojha@...eaurora.org>,
Dan Murphy <dmurphy@...com>, Stable@...r.kernel.org,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Sasha Levin <sashal@...nel.org>, linux-iio@...r.kernel.org
Subject: [PATCH AUTOSEL 5.1 01/70] iio: adc: ads124: avoid buffer overflow
From: Vincent Stehlé <vincent.stehle@...oste.net>
[ Upstream commit 0db8aa49a97e7f40852a64fd35abcc1292a7c365 ]
When initializing the priv->data array starting from index 1, there is one
less element to consider than when initializing the full array.
Fixes: e717f8c6dfec8f76 ("iio: adc: Add the TI ads124s08 ADC code")
Signed-off-by: Vincent Stehlé <vincent.stehle@...oste.net>
Reviewed-by: Mukesh Ojha <mojha@...eaurora.org>
Reviewed-by: Dan Murphy <dmurphy@...com>
Cc: <Stable@...r.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/iio/adc/ti-ads124s08.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ti-ads124s08.c b/drivers/iio/adc/ti-ads124s08.c
index 53f17e4f2f23..552c2be8d87a 100644
--- a/drivers/iio/adc/ti-ads124s08.c
+++ b/drivers/iio/adc/ti-ads124s08.c
@@ -202,7 +202,7 @@ static int ads124s_read(struct iio_dev *indio_dev, unsigned int chan)
};
priv->data[0] = ADS124S08_CMD_RDATA;
- memset(&priv->data[1], ADS124S08_CMD_NOP, sizeof(priv->data));
+ memset(&priv->data[1], ADS124S08_CMD_NOP, sizeof(priv->data) - 1);
ret = spi_sync_transfer(priv->spi, t, ARRAY_SIZE(t));
if (ret < 0)
--
2.20.1
Powered by blists - more mailing lists