From: Jonathan Cameron <jic23@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dan Robertson <dan@dlrobertson.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2] iio: accel: bma400: prevent setting accel scale too low
Date: Sat, 18 Jan 2020 13:34:27 +0000 [thread overview]
Message-ID: <20200118133427.07a665f6@archlinux> (raw)
In-Reply-To: <20200116100829.thq77nvyqtasdu4j@kili.mountain>
On Thu, 16 Jan 2020 13:08:29 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:
> This puts an upper bound on "val2" but it also needs to have a lower
> bound (BMA400_SCALE_MIN).
>
> Fixes: 465c811f1f20 ("iio: accel: Add driver for the BMA400")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to the togreg branch of iio.git and pushed out as testing.
Hopefully I'll sneak in a pull request to get this lined up for
the merge window.
Thanks,
Jonathan
> ---
> v2: the first version just capped it at zero but it should be
> BMA400_SCALE_MIN (38357).
>
> drivers/iio/accel/bma400_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/accel/bma400_core.c b/drivers/iio/accel/bma400_core.c
> index ab4a158b35af..cc77f89c048b 100644
> --- a/drivers/iio/accel/bma400_core.c
> +++ b/drivers/iio/accel/bma400_core.c
> @@ -752,7 +752,8 @@ static int bma400_write_raw(struct iio_dev *indio_dev,
> mutex_unlock(&data->mutex);
> return ret;
> case IIO_CHAN_INFO_SCALE:
> - if (val != 0 || val2 > BMA400_SCALE_MAX)
> + if (val != 0 ||
> + val2 < BMA400_SCALE_MIN || val2 > BMA400_SCALE_MAX)
> return -EINVAL;
>
> mutex_lock(&data->mutex);
prev parent reply other threads:[~2020-01-18 13:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-15 17:45 [PATCH] iio: accel: bma400: integer underflow setting accel scale Dan Carpenter
2020-01-15 17:45 ` Dan Carpenter
2020-01-15 17:43 ` Dan Robertson
2020-01-15 18:09 ` Dan Carpenter
2020-01-15 18:09 ` Dan Carpenter
2020-01-15 17:58 ` Dan Robertson
2020-01-15 18:17 ` Dan Robertson
2020-01-16 6:24 ` Dan Carpenter
2020-01-16 6:24 ` Dan Carpenter
2020-01-16 10:08 ` [PATCH v2] iio: accel: bma400: prevent setting accel scale too low Dan Carpenter
2020-01-16 10:08 ` Dan Carpenter
2020-01-18 13:34 ` Jonathan Cameron [this message]
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=20200118133427.07a665f6@archlinux \
--to=jic23@kernel.org \
--cc=Jonathan.Cameron@huawei.com \
--cc=andy.shevchenko@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=dan@dlrobertson.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.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 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.