All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Michael Hennerich <michael.hennerich@analog.com>,
	linux-iio@vger.kernel.org,
	device-drivers-devel@blackfin.uclinux.org, drivers@analog.com
Subject: Re: [PATCH] staging:iio:dac:ad5686: Check for negative values
Date: Wed, 19 Oct 2011 16:49:11 +0100	[thread overview]
Message-ID: <4E9EF177.80807@cam.ac.uk> (raw)
In-Reply-To: <1319039103-16706-1-git-send-email-lars@metafoo.de>

On 10/19/11 16:45, Lars-Peter Clausen wrote:
> Currently it is possible to write negative values to the ad5686's raw attribute.
> This will cause undefined behaviour, so reject negative values.
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>
> ---
>  drivers/staging/iio/dac/ad5686.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/iio/dac/ad5686.c b/drivers/staging/iio/dac/ad5686.c
> index 1d50dd1..48389e1 100644
> --- a/drivers/staging/iio/dac/ad5686.c
> +++ b/drivers/staging/iio/dac/ad5686.c
> @@ -327,7 +327,7 @@ static int ad5686_write_raw(struct iio_dev *indio_dev,
>  
>  	switch (mask) {
>  	case 0:
> -		if (val > (1 << chan->scan_type.realbits))
> +		if (val > (1 << chan->scan_type.realbits) || val < 0)
>  			return -EINVAL;
>  
>  		mutex_lock(&indio_dev->mlock);


  reply	other threads:[~2011-10-19 15:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19 15:45 [PATCH] staging:iio:dac:ad5686: Check for negative values Lars-Peter Clausen
2011-10-19 15:49 ` Jonathan Cameron [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-10-19 15:51 Lars-Peter Clausen

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=4E9EF177.80807@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=device-drivers-devel@blackfin.uclinux.org \
    --cc=drivers@analog.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.