From: Lars-Peter Clausen Date: Mon, 22 Oct 2012 11:15:00 +0000 (+0100) Subject: iio: Do not accept multiple '.' in fixed point numbers X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=8f1b7eb11422d28fbc7432f0dee2f97aead09417;p=linux-beck.git 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 --- 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;