summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-10-22 13:15:00 +0200
committerJonathan Cameron <jic23@kernel.org>2012-11-02 10:43:47 +0100
commit8f1b7eb11422d28fbc7432f0dee2f97aead09417 (patch)
treeeadfcfeb19e66b8d47ad9481dd9cf806a67a0930 /drivers/iio
parentstaging: iio: adc: ad7280a.c: fixed macro coding style (diff)
downloadlinux-8f1b7eb11422d28fbc7432f0dee2f97aead09417.tar.xz
linux-8f1b7eb11422d28fbc7432f0dee2f97aead09417.zip
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>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/industrialio-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 37650a72b31f..0994239361ba 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -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;