提交 e278df1c 编写于 作者: P Peter Meerwald 提交者: Greg Kroah-Hartman

staging: iio: add check for measurement configuration value passed to hmc5843

Signed-off-by: NPeter Meerwald <pmeerw@pmeerw.net>
Acked-by: NJonathan Cameron <jic23@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 13f6eb69
......@@ -281,9 +281,14 @@ static ssize_t hmc5843_set_measurement_configuration(struct device *dev,
struct i2c_client *client = to_i2c_client(indio_dev->dev.parent);
struct hmc5843_data *data = iio_priv(indio_dev);
unsigned long meas_conf = 0;
int error = kstrtoul(buf, 10, &meas_conf);
int error;
error = kstrtoul(buf, 10, &meas_conf);
if (error)
return error;
if (meas_conf >= HMC5843_MEAS_CONF_NOT_USED)
return -EINVAL;
mutex_lock(&data->lock);
dev_dbg(dev, "set mode to %lu\n", meas_conf);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册