Re: [PATCH 1/3] iio: Do not accept multiple '.' in fixed point numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/22/2012 12:15 PM, Lars-Peter Clausen wrote:
> 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@xxxxxxxxxx>
Added to togreg branch of iio.git

> ---
>  drivers/iio/industrialio-core.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 6eb24db..a2e9953 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -449,7 +449,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;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux