mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 09:44:18 +08:00
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: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
fad109452e
commit
8f1b7eb114
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user