提交 8f1b7eb1 编写于 作者: L Lars-Peter Clausen 提交者: Jonathan Cameron

iio: Do not accept multiple '.' in fixed point numbers

Currently when parsing a fix-point number we silently skip any additional '.'
found in the string.  E.g. '1.2.3.4' gets parsed as '1.234'. This patch
disallows this and returns an error if more than one '.' is encountered.
Signed-off-by: NLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: NJonathan Cameron <jic23@kernel.org>
上级 fad10945
......@@ -454,7 +454,7 @@ static ssize_t iio_write_channel_info(struct device *dev,
break;
else
return -EINVAL;
} else if (*buf == '.') {
} else if (*buf == '.' && integer_part) {
integer_part = false;
} else {
return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册