From 8f1b7eb11422d28fbc7432f0dee2f97aead09417 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 22 Oct 2012 12:15:00 +0100 Subject: 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 Signed-off-by: Jonathan Cameron --- drivers/iio/industrialio-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/iio') 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; -- cgit v1.2.3