diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-09-04 22:57:19 -0700 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-09-04 22:57:19 -0700 |
| commit | e6c340171f0daaccc95b90abbeed2b837157ee11 (patch) | |
| tree | 843d4035be59bd791321910e52157ce527b3b4b3 /include/linux/sunrpc/cache.h | |
| parent | a85442ade272121927a56e02f7dfde1127482df2 (diff) | |
| parent | 4cbe5a555fa58a79b6ecbb6c531b8bab0650778d (diff) | |
Merge tag 'v3.6-rc4' into next
Linux 3.6-rc4
# gpg: Signature made Sat 01 Sep 2012 10:40:33 AM PDT using RSA key ID 00411886
# gpg: Good signature from "Linus Torvalds <torvalds@linux-foundation.org>"
Diffstat (limited to 'include/linux/sunrpc/cache.h')
| -rw-r--r-- | include/linux/sunrpc/cache.h | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index f5fd6160dbca..f792794f6634 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h @@ -217,14 +217,32 @@ 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, 50); - if (len < 0) return -EINVAL; - if (len ==0) return -ENOENT; - rv = simple_strtol(buf, &ep, 0); - if (*ep) return -EINVAL; - *anint = rv; + int len = qword_get(bpp, buf, sizeof(buf)); + + if (len < 0) + return -EINVAL; + if (len == 0) + return -ENOENT; + + if (kstrtoint(buf, 0, anint)) + return -EINVAL; + + return 0; +} + +static inline int get_uint(char **bpp, unsigned int *anint) +{ + char buf[50]; + int len = qword_get(bpp, buf, sizeof(buf)); + + if (len < 0) + return -EINVAL; + if (len == 0) + return -ENOENT; + + if (kstrtouint(buf, 0, anint)) + return -EINVAL; + return 0; } |
