Skip to content

Commit

Permalink
iio: Do not accept multiple '.' in fixed point numbers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Nov 2, 2012
1 parent fad1094 commit 8f1b7eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/industrialio-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8f1b7eb

Please sign in to comment.