diff options
author | Andreas Ruprecht <rupran@einserver.de> | 2011-11-27 23:17:42 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-11-29 10:12:06 +0900 |
commit | 3b724ca14565747926c23af1fa1afb1848c3f448 (patch) | |
tree | b9e2fd6b22e5ec186badbfb9f3d8df23a295cd80 /drivers | |
parent | 359f9caa4df27ca0546a787d086f4c06306300b6 (diff) | |
download | op-kernel-dev-3b724ca14565747926c23af1fa1afb1848c3f448.zip op-kernel-dev-3b724ca14565747926c23af1fa1afb1848c3f448.tar.gz |
Staging: iio/accel: Changed data type of val in store_measurement_mode to u8
The code in sca3000_store_measurement_mode() uses the variable val to
do bitwise operations with an int mask and or-s it into st->rx[0] which
is an entry in a u8 array (see sca3000.h).
This means up to now values larger than a u8 were silently ignored and
just the lower 8 bits counted into the value that was written into
st->rx[0]. This code will return -ERANGE if the value in buf was too
large to fit into a u8.
Signed-off-by: Andreas Ruprecht <rupran@einserver.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/iio/accel/sca3000_core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c index 94bfe05..12ee6f8 100644 --- a/drivers/staging/iio/accel/sca3000_core.c +++ b/drivers/staging/iio/accel/sca3000_core.c @@ -383,10 +383,10 @@ sca3000_store_measurement_mode(struct device *dev, struct sca3000_state *st = iio_priv(indio_dev); int ret; int mask = 0x03; - long val; + u8 val; mutex_lock(&st->lock); - ret = strict_strtol(buf, 10, &val); + ret = kstrtou8(buf, 10, &val); if (ret) goto error_ret; ret = sca3000_read_data_short(st, SCA3000_REG_ADDR_MODE, 1); |