diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c index 09ab0e497a232df94d7a556c46ebe4eaff9592c7..9dca666f825c0a01e1aa82a9c956ebc4c07f8a53 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c @@ -229,18 +229,13 @@ int cfs_str2num_check(char *str, int nob, unsigned *num, unsigned min, unsigned max) { - char *endp; + int rc; str = cfs_trimwhite(str); - *num = simple_strtoul(str, &endp, 0); - if (endp == str) + rc = kstrtouint(str, 10, num); + if (rc) return 0; - for (; endp < str + nob; endp++) { - if (!isspace(*endp)) - return 0; - } - return (*num >= min && *num <= max); } EXPORT_SYMBOL(cfs_str2num_check);