mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mukesh Ojha <mojha@codeaurora.org>
To: "Vincent Stehlé" <vincent.stehle@laposte.net>, linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Dan Murphy <dmurphy@ti.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH] iio: adc: ads124: avoid buffer overflow
Date: Mon, 1 Apr 2019 14:02:34 +0530	[thread overview]
Message-ID: <a133aeda-6477-0fd7-77b3-7a5383370f96@codeaurora.org> (raw)
In-Reply-To: <20190331185423.11749-1-vincent.stehle@laposte.net>


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@laposte.net>
> Cc: Dan Murphy <dmurphy@ti.com>
> Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>


Reviewed-by: Mukesh Ojha <mojha@codeaurora.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)

  reply	other threads:[~2019-04-01  8:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-31 18:54 Vincent Stehlé
2019-04-01  8:32 ` Mukesh Ojha [this message]
2019-04-01 12:41 ` Dan Murphy
2019-04-07 12:02   ` Jonathan Cameron
2019-04-07 12:03     ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a133aeda-6477-0fd7-77b3-7a5383370f96@codeaurora.org \
    --to=mojha@codeaurora.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=dmurphy@ti.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vincent.stehle@laposte.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®