From: "J. Bruce Fields" <bfields@fieldses.org>
To: Abhijit Pawar <abhi.c.pawar@gmail.com>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] include/sunrpc: remove obsolete simple_strto<foo>
Date: Fri, 7 Dec 2012 08:04:18 -0500 [thread overview]
Message-ID: <20121207130418.GC17115@fieldses.org> (raw)
In-Reply-To: <1354881096-23480-1-git-send-email-abhi.c.pawar@gmail.com>
On Fri, Dec 07, 2012 at 05:21:36PM +0530, Abhijit Pawar wrote:
> This patch replace the obsolete simple_strto<foo> with kstrto<foo>
No, we can't apply this as is--see the recent revert of a similar
change, below.
kstrtoint does not have the same behavior as simple_strtol, so don't
blindly replace one by the other. At a bare minimum the changelog
should have a note about the differences to help maintainers determine
if the change will cause problems.
--b.
> Signed-off-by: Abhijit Pawar <abhi.c.pawar@gmail.com>
> ---
> include/linux/sunrpc/cache.h | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
> index 5dc9ee4..96d2545 100644
> --- a/include/linux/sunrpc/cache.h
> +++ b/include/linux/sunrpc/cache.h
> @@ -218,7 +218,7 @@ static inline int get_int(char **bpp, int *anint)
> {
> char buf[50];
> char *ep;
> - int rv;
> + int rv, rc;
> int len = qword_get(bpp, buf, sizeof(buf));
>
> if (len < 0)
> @@ -226,8 +226,8 @@ static inline int get_int(char **bpp, int *anint)
> if (len == 0)
> return -ENOENT;
>
> - rv = simple_strtol(buf, &ep, 0);
> - if (*ep)
> + rc = kstrtoint(buf, 0, &rv);
> + if (rc)
> return -EINVAL;
>
> *anint = rv;
commit 621eb19ce1ec216e03ad354cb0c4061736b2a436
Author: J. Bruce Fields <bfields@redhat.com>
Date: Wed Nov 14 10:48:05 2012 -0500
svcrpc: Revert "sunrpc/cache.h: replace simple_strtoul"
Commit bbf43dc888833ac0539e437dbaeb28bfd4fbab9f "sunrpc/cache.h: replace
simple_strtoul" introduced new range-checking which could cause get_int
to fail on unsigned integers too large to be represented as an int.
We could parse them as unsigned instead--but it turns out svcgssd is
actually passing down "-1" in some cases. Which is perhaps stupid, but
there's nothing we can do about it now.
So just revert back to the previous "sloppy" behavior that accepts
either representation.
Cc: stable@vger.kernel.org
Reported-by: Sven Geggus <lists@fuchsschwanzdomain.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index f792794..5dc9ee4 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -217,6 +217,8 @@ extern int qword_get(char **bpp, char *dest, int bufsize);
static inline int get_int(char **bpp, int *anint)
{
char buf[50];
+ char *ep;
+ int rv;
int len = qword_get(bpp, buf, sizeof(buf));
if (len < 0)
@@ -224,9 +226,11 @@ static inline int get_int(char **bpp, int *anint)
if (len == 0)
return -ENOENT;
- if (kstrtoint(buf, 0, anint))
+ rv = simple_strtol(buf, &ep, 0);
+ if (*ep)
return -EINVAL;
+ *anint = rv;
return 0;
}
prev parent reply other threads:[~2012-12-07 13:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-07 11:51 [PATCH 3/4] include/sunrpc: remove obsolete simple_strto<foo> Abhijit Pawar
2012-12-07 13:04 ` J. Bruce Fields [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=20121207130418.GC17115@fieldses.org \
--to=bfields@fieldses.org \
--cc=Trond.Myklebust@netapp.com \
--cc=abhi.c.pawar@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).