[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a133aeda-6477-0fd7-77b3-7a5383370f96@codeaurora.org>
Date: Mon, 1 Apr 2019 14:02:34 +0530
From: Mukesh Ojha <mojha@...eaurora.org>
To: Vincent Stehlé <vincent.stehle@...oste.net>,
linux-iio@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Dan Murphy <dmurphy@...com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH] iio: adc: ads124: avoid buffer overflow
On 4/1/2019 12:24 AM, Vincent Stehlé wrote:
> 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>
> Cc: Dan Murphy <dmurphy@...com>
> Cc: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Reviewed-by: Mukesh Ojha <mojha@...eaurora.org>
Cheers,
-Mukesh
> ---
> 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 53f17e4f2f230..552c2be8d87ad 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)
Powered by blists - more mailing lists