From: Lars-Peter Clausen <lars@metafoo.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jonathan Cameron <jic23@cam.ac.uk>,
linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] iio:gyro: adis16136: divide by zero in write_frequency()
Date: Tue, 27 Nov 2012 18:40:46 +0000 [thread overview]
Message-ID: <50B5092E.7060103@metafoo.de> (raw)
In-Reply-To: <20121127072452.GA8239@elgon.mountain>
On 11/27/2012 08:24 AM, Dan Carpenter wrote:
> It's slightly cleaner to use kstrtouint() because we pass unsigned ints
> to adis16136_set_freq(). On 64 bit systems, if the user passed LONG_MIN
> then it we would get past the test against zero but crash in
> adis16136_set_freq() because we truncate the high bits away.
>
>
Thanks,
Acked-By: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c
> index 05486df..b4ee339 100644
> --- a/drivers/iio/gyro/adis16136.c
> +++ b/drivers/iio/gyro/adis16136.c
> @@ -203,10 +203,10 @@ static ssize_t adis16136_write_frequency(struct device *dev,
> {
> struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> struct adis16136 *adis16136 = iio_priv(indio_dev);
> - long val;
> + unsigned int val;
> int ret;
>
> - ret = kstrtol(buf, 10, &val);
> + ret = kstrtouint(buf, 10, &val);
> if (ret)
> return ret;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Lars-Peter Clausen <lars@metafoo.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Jonathan Cameron <jic23@cam.ac.uk>,
linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] iio:gyro: adis16136: divide by zero in write_frequency()
Date: Tue, 27 Nov 2012 19:40:46 +0100 [thread overview]
Message-ID: <50B5092E.7060103@metafoo.de> (raw)
In-Reply-To: <20121127072452.GA8239@elgon.mountain>
On 11/27/2012 08:24 AM, Dan Carpenter wrote:
> It's slightly cleaner to use kstrtouint() because we pass unsigned ints
> to adis16136_set_freq(). On 64 bit systems, if the user passed LONG_MIN
> then it we would get past the test against zero but crash in
> adis16136_set_freq() because we truncate the high bits away.
>
>
Thanks,
Acked-By: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c
> index 05486df..b4ee339 100644
> --- a/drivers/iio/gyro/adis16136.c
> +++ b/drivers/iio/gyro/adis16136.c
> @@ -203,10 +203,10 @@ static ssize_t adis16136_write_frequency(struct device *dev,
> {
> struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> struct adis16136 *adis16136 = iio_priv(indio_dev);
> - long val;
> + unsigned int val;
> int ret;
>
> - ret = kstrtol(buf, 10, &val);
> + ret = kstrtouint(buf, 10, &val);
> if (ret)
> return ret;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-11-27 18:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-27 7:24 [patch] iio:gyro: adis16136: divide by zero in write_frequency() Dan Carpenter
2012-11-27 7:24 ` Dan Carpenter
2012-11-27 18:40 ` Lars-Peter Clausen [this message]
2012-11-27 18:40 ` Lars-Peter Clausen
2012-11-30 13:13 ` 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=50B5092E.7060103@metafoo.de \
--to=lars@metafoo.de \
--cc=dan.carpenter@oracle.com \
--cc=jic23@cam.ac.uk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
/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.