From: "J. Bruce Fields" <bfields@fieldses.org>
To: Eldad Zack <eldad@fogrefinery.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Joe Perches <joe@perches.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] kstrto*: add documentation
Date: Thu, 12 Jul 2012 18:16:22 -0400 [thread overview]
Message-ID: <20120712221622.GD24162@fieldses.org> (raw)
In-Reply-To: <alpine.DEB.2.02.1207122351580.21938@debianer>
On Fri, Jul 13, 2012 at 12:09:37AM +0200, Eldad Zack wrote:
>
> On Thu, 12 Jul 2012, J. Bruce Fields wrote:
> > On Thu, Jul 12, 2012 at 10:53:13PM +0200, Eldad Zack wrote:
> > > +/**
> > > + * kstrtoul - convert a string to an unsigned long
> >
> > Also, is it worth mentioning that the number is required to be followed
> > by a string or newline?
>
> I am not sure if I understand _parse_integer correctly (which is called
> to do the actual parsing and has a very nice comment to it) - but it
> expects a null-terminated string, but will also stop as soon as it
> bumps into any other non-number character without error (please correct
> me I'm wrong).
I believe it, but, in _kstrtoull:
rv = _parse_integer(s, base, &_res);
if (rv & KSTRTOX_OVERFLOW)
return -ERANGE;
rv &= ~KSTRTOX_OVERFLOW;
if (rv == 0)
return -EINVAL;
s += rv;
if (*s == '\n')
s++;
if (*s)
return -EINVAL;
So actually it appears the string must be all numeric except possibly a final
newline.
--b.
next prev parent reply other threads:[~2012-07-12 22:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-12 20:53 [PATCH 1/2] kstrto*: add documentation Eldad Zack
2012-07-12 20:53 ` [PATCH 2/2] simple_strto*: annotate function as obsolete Eldad Zack
2012-07-12 21:17 ` [PATCH 1/2] kstrto*: add documentation Stephen Boyd
2012-07-12 21:19 ` Stephen Boyd
2012-07-12 21:23 ` J. Bruce Fields
2012-07-12 22:09 ` Eldad Zack
2012-07-12 22:16 ` J. Bruce Fields [this message]
2012-07-12 22:27 ` Eldad Zack
-- strict thread matches above, loose matches on Subject: below --
2012-09-30 11:44 Eldad Zack
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=20120712221622.GD24162@fieldses.org \
--to=bfields@fieldses.org \
--cc=akpm@linux-foundation.org \
--cc=eldad@fogrefinery.com \
--cc=joe@perches.com \
--cc=linux-kernel@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.