aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent StehlĂ© <[email protected]>2019-03-31 20:54:23 +0200
committerJonathan Cameron <[email protected]>2019-04-07 13:01:36 +0100
commit0db8aa49a97e7f40852a64fd35abcc1292a7c365 (patch)
treee37d55a046340917a6fa881aae0a846eff201663
parent4e63ed6b90803eeb400c392e9ff493200d926b06 (diff)
iio: adc: ads124: avoid buffer overflow
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Ă© <[email protected]> Reviewed-by: Mukesh Ojha <[email protected]> Reviewed-by: Dan Murphy <[email protected]> Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
-rw-r--r--drivers/iio/adc/ti-ads124s08.c2
1 files changed, 1 insertions, 1 deletions
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)