diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-11-27 02:24:00 -0500 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2012-11-30 08:09:22 -0500 |
commit | 12660138b491b56d1e70333547912c56741be5e8 (patch) | |
tree | 321742511bde3e748bb986f81300fc002d7834bf /drivers/iio/gyro | |
parent | bc0a409c5ffd91b5403037ab2798b84dccee4f06 (diff) |
iio:gyro: adis16136: divide by zero in write_frequency()
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.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-By: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/gyro')
-rw-r--r-- | drivers/iio/gyro/adis16136.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c index 05486dfd721b..b4ee3393b772 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, | |||
203 | { | 203 | { |
204 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); | 204 | struct iio_dev *indio_dev = dev_to_iio_dev(dev); |
205 | struct adis16136 *adis16136 = iio_priv(indio_dev); | 205 | struct adis16136 *adis16136 = iio_priv(indio_dev); |
206 | long val; | 206 | unsigned int val; |
207 | int ret; | 207 | int ret; |
208 | 208 | ||
209 | ret = kstrtol(buf, 10, &val); | 209 | ret = kstrtouint(buf, 10, &val); |
210 | if (ret) | 210 | if (ret) |
211 | return ret; | 211 | return ret; |
212 | 212 | ||