summaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc/cache.h
diff options
context:
space:
mode:
authorEldad Zack2012-07-06 21:31:57 +0200
committerJ. Bruce Fields2012-07-11 22:08:00 +0200
commitbbf43dc888833ac0539e437dbaeb28bfd4fbab9f (patch)
tree3e75d68f3811f438c451281e30ec5ad16b555c58 /include/linux/sunrpc/cache.h
parentsunrpc/cache.h: fix coding style (diff)
downloadkernel-qcow2-linux-bbf43dc888833ac0539e437dbaeb28bfd4fbab9f.tar.gz
kernel-qcow2-linux-bbf43dc888833ac0539e437dbaeb28bfd4fbab9f.tar.xz
kernel-qcow2-linux-bbf43dc888833ac0539e437dbaeb28bfd4fbab9f.zip
sunrpc/cache.h: replace simple_strtoul
This patch replaces the usage of simple_strtoul with kstrtoint in get_int(), since the simple_str* family doesn't account for overflow and is deprecated. Also, in this specific case, the long from strtol is silently converted to an int by the caller. As Joe Perches <joe@perches.com> suggested, this patch also removes the redundant temporary variable rv, since kstrtoint() will not write to anint unless it's successful. Cc: Joe Perches <joe@perches.com> Signed-off-by: Eldad Zack <eldad@fogrefinery.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'include/linux/sunrpc/cache.h')
-rw-r--r--include/linux/sunrpc/cache.h6
1 files changed, 1 insertions, 5 deletions
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 6def1f6cc269..af42596a82f9 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -217,8 +217,6 @@ 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)
@@ -226,11 +224,9 @@ static inline int get_int(char **bpp, int *anint)
if (len == 0)
return -ENOENT;
- rv = simple_strtol(buf, &ep, 0);
- if (*ep)
+ if (kstrtoint(buf, 0, anint))
return -EINVAL;
- *anint = rv;
return 0;
}