linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.1 01/70] iio: adc: ads124: avoid buffer overflow
@ 2019-06-08 11:38 Sasha Levin
  2019-06-08 11:38 ` [PATCH AUTOSEL 5.1 02/70] iio: imu: mpu6050: Fix FIFO layout for ICM20602 Sasha Levin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sasha Levin @ 2019-06-08 11:38 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vincent Stehlé,
	Mukesh Ojha, Dan Murphy, Stable, Jonathan Cameron, Sasha Levin,
	linux-iio

From: Vincent Stehlé <vincent.stehle@laposte.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@laposte.net>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Reviewed-by: Dan Murphy <dmurphy@ti.com>
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/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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-08 11:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-08 11:38 [PATCH AUTOSEL 5.1 01/70] iio: adc: ads124: avoid buffer overflow Sasha Levin
2019-06-08 11:38 ` [PATCH AUTOSEL 5.1 02/70] iio: imu: mpu6050: Fix FIFO layout for ICM20602 Sasha Levin
2019-06-08 11:38 ` [PATCH AUTOSEL 5.1 03/70] iio: dac: ds4422/ds4424 fix chip verification Sasha Levin
2019-06-08 11:38 ` [PATCH AUTOSEL 5.1 04/70] iio: adc: ti-ads8688: fix timestamp is not updated in buffer Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).