mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-12 05:48:39 +08:00
iio: accel: bma400: prevent setting accel scale too low
This puts an upper bound on "val2" but it also needs to have a lower
bound (BMA400_SCALE_MIN).
Fixes: 465c811f1f
("iio: accel: Add driver for the BMA400")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
84961af78c
commit
98496ccdf0
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user