[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190607153852.884905919@linuxfoundation.org>
Date: Fri, 7 Jun 2019 17:39:14 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
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>
Subject: [PATCH 5.1 29/85] iio: adc: ads124: avoid buffer overflow
From: Vincent Stehlé <vincent.stehle@...oste.net>
commit 0db8aa49a97e7f40852a64fd35abcc1292a7c365 upstream.
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: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/iio/adc/ti-ads124s08.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- 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 *
};
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)
Powered by blists - more mailing lists