All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jonathan Cameron <jic23@cam.ac.uk>, linux-iio@vger.kernel.org
Subject: Re: [PATCH 1/3] iio: Do not accept multiple '.' in fixed point numbers
Date: Fri, 02 Nov 2012 09:44:39 +0000	[thread overview]
Message-ID: <50939607.7090609@kernel.org> (raw)
In-Reply-To: <1350904515-696-1-git-send-email-lars@metafoo.de>

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@metafoo.de>
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;
> 

      parent reply	other threads:[~2012-11-02  9:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 11:15 [PATCH 1/3] iio: Do not accept multiple '.' in fixed point numbers Lars-Peter Clausen
2012-10-22 11:15 ` [PATCH 2/3] iio: Reject trailing garbage when parsing " Lars-Peter Clausen
2012-11-02  9:45   ` Jonathan Cameron
2012-10-22 11:15 ` [PATCH 3/3] iio: Accept a leading '+' sign " Lars-Peter Clausen
2012-11-02  9:46   ` Jonathan Cameron
2012-11-02  9:44 ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50939607.7090609@kernel.org \
    --to=jic23@kernel.org \
    --cc=jic23@cam.ac.uk \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.