diff options
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); | |||
217 | static inline int get_int(char **bpp, int *anint) | 217 | static inline int get_int(char **bpp, int *anint) |
218 | { | 218 | { |
219 | char buf[50]; | 219 | char buf[50]; |
220 | char *ep; | 220 | int len = qword_get(bpp, buf, sizeof(buf)); |
221 | int rv; | 221 | |
222 | int len = qword_get(bpp, buf, 50); | 222 | if (len < 0) |
223 | if (len < 0) return -EINVAL; | 223 | return -EINVAL; |
224 | if (len ==0) return -ENOENT; | 224 | if (len == 0) |
225 | rv = simple_strtol(buf, &ep, 0); | 225 | return -ENOENT; |
226 | if (*ep) return -EINVAL; | 226 | |
227 | *anint = rv; | 227 | if (kstrtoint(buf, 0, anint)) |
228 | return -EINVAL; | ||
229 | |||
230 | return 0; | ||
231 | } | ||
232 | |||
233 | static inline int get_uint(char **bpp, unsigned int *anint) | ||
234 | { | ||
235 | char buf[50]; | ||
236 | int len = qword_get(bpp, buf, sizeof(buf)); | ||
237 | |||
238 | if (len < 0) | ||
239 | return -EINVAL; | ||
240 | if (len == 0) | ||
241 | return -ENOENT; | ||
242 | |||
243 | if (kstrtouint(buf, 0, anint)) | ||
244 | return -EINVAL; | ||
245 | |||
228 | return 0; | 246 | return 0; |
229 | } | 247 | } |
230 | 248 | ||