Skip to content

Commit

Permalink
iio:gyro: adis16136: divide by zero in write_frequency()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Jonathan Cameron committed Nov 30, 2012
1 parent bc0a409 commit 1266013
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/iio/gyro/adis16136.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 1266013

Please sign in to comment.