| From | Greg Kroah-Hartman <> | Subject | [PATCH 5.1 29/85] iio: adc: ads124: avoid buffer overflow | Date | Fri, 7 Jun 2019 17:39:14 +0200 |
| |
From: Vincent Stehlé <vincent.stehle@laposte.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@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: Greg Kroah-Hartman <gregkh@linuxfoundation.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)
|