public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] fs/xfs remove obsolete simple_strto<foo>
@ 2013-01-09 14:04 Abhijit Pawar
  2013-01-11  6:36 ` Jeff Liu
  2013-01-12  2:54 ` Jeff Liu
  0 siblings, 2 replies; 7+ messages in thread
From: Abhijit Pawar @ 2013-01-09 14:04 UTC (permalink / raw)
  To: Ben Myers, jeff.liu; +Cc: Alex Elder, xfs, linux-kernel, david, Abhijit Pawar

This patch replaces usages of obsolete simple_strtoul with kstrtoint in xfs_args and suffix_strtoul.

Signed-off-by: Abhijit Pawar <abhi.c.pawar@gmail.com>
---
 fs/xfs/xfs_super.c |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index ab8839b..c407121 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -139,9 +139,9 @@ static const match_table_t tokens = {
 
 
 STATIC unsigned long
-suffix_strtoul(char *s, char **endp, unsigned int base)
+suffix_kstrtoint(char *s, unsigned int base, int *res)
 {
-	int	last, shift_left_factor = 0;
+	int	last, shift_left_factor = 0, _res;
 	char	*value = s;
 
 	last = strlen(value) - 1;
@@ -158,7 +158,10 @@ suffix_strtoul(char *s, char **endp, unsigned int base)
 		value[last] = '\0';
 	}
 
-	return simple_strtoul((const char *)s, endp, base) << shift_left_factor;
+	if (kstrtoint(s, base, &_res))
+		return -EINVAL;
+	*res = _res << shift_left_factor;
+	return 0;
 }
 
 /*
@@ -174,7 +177,7 @@ xfs_parseargs(
 	char			*options)
 {
 	struct super_block	*sb = mp->m_super;
-	char			*this_char, *value, *eov;
+	char			*this_char, *value;
 	int			dsunit = 0;
 	int			dswidth = 0;
 	int			iosize = 0;
@@ -230,14 +233,16 @@ xfs_parseargs(
 					this_char);
 				return EINVAL;
 			}
-			mp->m_logbufs = simple_strtoul(value, &eov, 10);
+			if (kstrtoint(value, 10, &mp->m_logbufs))
+				return EINVAL;
 		} else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
 			if (!value || !*value) {
 				xfs_warn(mp, "%s option requires an argument",
 					this_char);
 				return EINVAL;
 			}
-			mp->m_logbsize = suffix_strtoul(value, &eov, 10);
+			if (suffix_kstrtoint(value, 10, &mp->m_logbsize))
+				return EINVAL;
 		} else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
 			if (!value || !*value) {
 				xfs_warn(mp, "%s option requires an argument",
@@ -266,7 +271,8 @@ xfs_parseargs(
 					this_char);
 				return EINVAL;
 			}
-			iosize = simple_strtoul(value, &eov, 10);
+			if (kstrtoint(value, 10, &iosize))
+				return EINVAL;
 			iosizelog = ffs(iosize) - 1;
 		} else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
 			if (!value || !*value) {
@@ -274,7 +280,8 @@ xfs_parseargs(
 					this_char);
 				return EINVAL;
 			}
-			iosize = suffix_strtoul(value, &eov, 10);
+			if (suffix_kstrtoint(value, 10, &iosize))
+				return EINVAL;
 			iosizelog = ffs(iosize) - 1;
 		} else if (!strcmp(this_char, MNTOPT_GRPID) ||
 			   !strcmp(this_char, MNTOPT_BSDGROUPS)) {
@@ -296,14 +303,16 @@ xfs_parseargs(
 					this_char);
 				return EINVAL;
 			}
-			dsunit = simple_strtoul(value, &eov, 10);
+			if (kstrtoint(value, 10, &dsunit))
+				return EINVAL;
 		} else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
 			if (!value || !*value) {
 				xfs_warn(mp, "%s option requires an argument",
 					this_char);
 				return EINVAL;
 			}
-			dswidth = simple_strtoul(value, &eov, 10);
+			if (kstrtoint(value, 10, &dswidth))
+				return EINVAL;
 		} else if (!strcmp(this_char, MNTOPT_32BITINODE)) {
 			mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
 		} else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] fs/xfs remove obsolete simple_strto<foo>
  2013-01-09 14:04 [PATCH 1/1] fs/xfs remove obsolete simple_strto<foo> Abhijit Pawar
@ 2013-01-11  6:36 ` Jeff Liu
  2013-01-11  7:46   ` Abhijit Pawar
  2013-01-11 22:52   ` Dave Chinner
  2013-01-12  2:54 ` Jeff Liu
  1 sibling, 2 replies; 7+ messages in thread
From: Jeff Liu @ 2013-01-11  6:36 UTC (permalink / raw)
  To: Abhijit Pawar; +Cc: Ben Myers, Alex Elder, linux-kernel, xfs

On 01/09/2013 10:04 PM, Abhijit Pawar wrote:
> This patch replaces usages of obsolete simple_strtoul with kstrtoint in xfs_args and suffix_strtoul.
> 
> Signed-off-by: Abhijit Pawar <abhi.c.pawar@gmail.com>
> ---
>  fs/xfs/xfs_super.c |   29 +++++++++++++++++++----------
>  1 files changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index ab8839b..c407121 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -139,9 +139,9 @@ static const match_table_t tokens = {
>  
>  
>  STATIC unsigned long
> -suffix_strtoul(char *s, char **endp, unsigned int base)
> +suffix_kstrtoint(char *s, unsigned int base, int *res)
>  {
> -	int	last, shift_left_factor = 0;
> +	int	last, shift_left_factor = 0, _res;
>  	char	*value = s;
>  
>  	last = strlen(value) - 1;
> @@ -158,7 +158,10 @@ suffix_strtoul(char *s, char **endp, unsigned int base)
>  		value[last] = '\0';
>  	}
>  
> -	return simple_strtoul((const char *)s, endp, base) << shift_left_factor;
> +	if (kstrtoint(s, base, &_res))
> +		return -EINVAL;
> +	*res = _res << shift_left_factor;
> +	return 0;
>  }
>  
>  /*
> @@ -174,7 +177,7 @@ xfs_parseargs(
>  	char			*options)
>  {
>  	struct super_block	*sb = mp->m_super;
> -	char			*this_char, *value, *eov;
> +	char			*this_char, *value;
>  	int			dsunit = 0;
>  	int			dswidth = 0;
>  	int			iosize = 0;
> @@ -230,14 +233,16 @@ xfs_parseargs(
>  					this_char);
>  				return EINVAL;
>  			}
> -			mp->m_logbufs = simple_strtoul(value, &eov, 10);
> +			if (kstrtoint(value, 10, &mp->m_logbufs))
> +				return EINVAL;
>  		} else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
>  			if (!value || !*value) {
>  				xfs_warn(mp, "%s option requires an argument",
>  					this_char);
>  				return EINVAL;
>  			}
> -			mp->m_logbsize = suffix_strtoul(value, &eov, 10);
> +			if (suffix_kstrtoint(value, 10, &mp->m_logbsize))
> +				return EINVAL;
>  		} else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
>  			if (!value || !*value) {
>  				xfs_warn(mp, "%s option requires an argument",
> @@ -266,7 +271,8 @@ xfs_parseargs(
>  					this_char);
>  				return EINVAL;
>  			}
> -			iosize = simple_strtoul(value, &eov, 10);
> +			if (kstrtoint(value, 10, &iosize))
> +				return EINVAL;
>  			iosizelog = ffs(iosize) - 1;
>  		} else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
>  			if (!value || !*value) {
> @@ -274,7 +280,8 @@ xfs_parseargs(
>  					this_char);
>  				return EINVAL;
>  			}
> -			iosize = suffix_strtoul(value, &eov, 10);
> +			if (suffix_kstrtoint(value, 10, &iosize))
> +				return EINVAL;
>  			iosizelog = ffs(iosize) - 1;
>  		} else if (!strcmp(this_char, MNTOPT_GRPID) ||
>  			   !strcmp(this_char, MNTOPT_BSDGROUPS)) {
> @@ -296,14 +303,16 @@ xfs_parseargs(
>  					this_char);
>  				return EINVAL;
>  			}
> -			dsunit = simple_strtoul(value, &eov, 10);
> +			if (kstrtoint(value, 10, &dsunit))
> +				return EINVAL;
>  		} else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
>  			if (!value || !*value) {
>  				xfs_warn(mp, "%s option requires an argument",
>  					this_char);
>  				return EINVAL;
>  			}
> -			dswidth = simple_strtoul(value, &eov, 10);
> +			if (kstrtoint(value, 10, &dswidth))
> +				return EINVAL;
>  		} else if (!strcmp(this_char, MNTOPT_32BITINODE)) {
>  			mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
>  		} else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
> 
checkpatch.pl show warning if we return EINVAL as below:
WARNING: return of an errno should typically be -ve (return -EINVAL)

Can we just ignore such code style issue?

Thanks,
-Jeff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] fs/xfs remove obsolete simple_strto<foo>
  2013-01-11  6:36 ` Jeff Liu
@ 2013-01-11  7:46   ` Abhijit Pawar
  2013-01-11 19:09     ` Ben Myers
  2013-01-11 22:52   ` Dave Chinner
  1 sibling, 1 reply; 7+ messages in thread
From: Abhijit Pawar @ 2013-01-11  7:46 UTC (permalink / raw)
  To: Jeff Liu; +Cc: Abhijit Pawar, Ben Myers, Alex Elder, linux-kernel, xfs

On 01/11/2013 12:06 PM, Jeff Liu wrote:
> On 01/09/2013 10:04 PM, Abhijit Pawar wrote:
>> This patch replaces usages of obsolete simple_strtoul with kstrtoint in xfs_args and suffix_strtoul.
>>
>> Signed-off-by: Abhijit Pawar <abhi.c.pawar@gmail.com>
>> ---
>>  fs/xfs/xfs_super.c |   29 +++++++++++++++++++----------
>>  1 files changed, 19 insertions(+), 10 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
>> index ab8839b..c407121 100644
>> --- a/fs/xfs/xfs_super.c
>> +++ b/fs/xfs/xfs_super.c
>> @@ -139,9 +139,9 @@ static const match_table_t tokens = {
>>  
>>  
>>  STATIC unsigned long
>> -suffix_strtoul(char *s, char **endp, unsigned int base)
>> +suffix_kstrtoint(char *s, unsigned int base, int *res)
>>  {
>> -	int	last, shift_left_factor = 0;
>> +	int	last, shift_left_factor = 0, _res;
>>  	char	*value = s;
>>  
>>  	last = strlen(value) - 1;
>> @@ -158,7 +158,10 @@ suffix_strtoul(char *s, char **endp, unsigned int base)
>>  		value[last] = '\0';
>>  	}
>>  
>> -	return simple_strtoul((const char *)s, endp, base) << shift_left_factor;
>> +	if (kstrtoint(s, base, &_res))
>> +		return -EINVAL;
>> +	*res = _res << shift_left_factor;
>> +	return 0;
>>  }
>>  
>>  /*
>> @@ -174,7 +177,7 @@ xfs_parseargs(
>>  	char			*options)
>>  {
>>  	struct super_block	*sb = mp->m_super;
>> -	char			*this_char, *value, *eov;
>> +	char			*this_char, *value;
>>  	int			dsunit = 0;
>>  	int			dswidth = 0;
>>  	int			iosize = 0;
>> @@ -230,14 +233,16 @@ xfs_parseargs(
>>  					this_char);
>>  				return EINVAL;
>>  			}
>> -			mp->m_logbufs = simple_strtoul(value, &eov, 10);
>> +			if (kstrtoint(value, 10, &mp->m_logbufs))
>> +				return EINVAL;
>>  		} else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
>>  			if (!value || !*value) {
>>  				xfs_warn(mp, "%s option requires an argument",
>>  					this_char);
>>  				return EINVAL;
>>  			}
>> -			mp->m_logbsize = suffix_strtoul(value, &eov, 10);
>> +			if (suffix_kstrtoint(value, 10, &mp->m_logbsize))
>> +				return EINVAL;
>>  		} else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
>>  			if (!value || !*value) {
>>  				xfs_warn(mp, "%s option requires an argument",
>> @@ -266,7 +271,8 @@ xfs_parseargs(
>>  					this_char);
>>  				return EINVAL;
>>  			}
>> -			iosize = simple_strtoul(value, &eov, 10);
>> +			if (kstrtoint(value, 10, &iosize))
>> +				return EINVAL;
>>  			iosizelog = ffs(iosize) - 1;
>>  		} else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
>>  			if (!value || !*value) {
>> @@ -274,7 +280,8 @@ xfs_parseargs(
>>  					this_char);
>>  				return EINVAL;
>>  			}
>> -			iosize = suffix_strtoul(value, &eov, 10);
>> +			if (suffix_kstrtoint(value, 10, &iosize))
>> +				return EINVAL;
>>  			iosizelog = ffs(iosize) - 1;
>>  		} else if (!strcmp(this_char, MNTOPT_GRPID) ||
>>  			   !strcmp(this_char, MNTOPT_BSDGROUPS)) {
>> @@ -296,14 +303,16 @@ xfs_parseargs(
>>  					this_char);
>>  				return EINVAL;
>>  			}
>> -			dsunit = simple_strtoul(value, &eov, 10);
>> +			if (kstrtoint(value, 10, &dsunit))
>> +				return EINVAL;
>>  		} else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
>>  			if (!value || !*value) {
>>  				xfs_warn(mp, "%s option requires an argument",
>>  					this_char);
>>  				return EINVAL;
>>  			}
>> -			dswidth = simple_strtoul(value, &eov, 10);
>> +			if (kstrtoint(value, 10, &dswidth))
>> +				return EINVAL;
>>  		} else if (!strcmp(this_char, MNTOPT_32BITINODE)) {
>>  			mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
>>  		} else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
>>
> checkpatch.pl show warning if we return EINVAL as below:
> WARNING: return of an errno should typically be -ve (return -EINVAL)
> 
> Can we just ignore such code style issue?
I think we can.
Ben?
> 
> Thanks,
> -Jeff
> 


-- 
-
Abhijit

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] fs/xfs remove obsolete simple_strto<foo>
  2013-01-11  7:46   ` Abhijit Pawar
@ 2013-01-11 19:09     ` Ben Myers
  0 siblings, 0 replies; 7+ messages in thread
From: Ben Myers @ 2013-01-11 19:09 UTC (permalink / raw)
  To: Abhijit Pawar; +Cc: Jeff Liu, Alex Elder, linux-kernel, xfs

Hey,

On Fri, Jan 11, 2013 at 01:16:30PM +0530, Abhijit Pawar wrote:
> On 01/11/2013 12:06 PM, Jeff Liu wrote:
> > On 01/09/2013 10:04 PM, Abhijit Pawar wrote:
> >> This patch replaces usages of obsolete simple_strtoul with kstrtoint in xfs_args and suffix_strtoul.
> >>
> >> Signed-off-by: Abhijit Pawar <abhi.c.pawar@gmail.com>
> > checkpatch.pl show warning if we return EINVAL as below:
> > WARNING: return of an errno should typically be -ve (return -EINVAL)
> > 
> > Can we just ignore such code style issue?
> I think we can.
> Ben?

Yep, no worries.

Regards,
	Ben

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] fs/xfs remove obsolete simple_strto<foo>
  2013-01-11  6:36 ` Jeff Liu
  2013-01-11  7:46   ` Abhijit Pawar
@ 2013-01-11 22:52   ` Dave Chinner
  2013-01-12  2:48     ` Jeff Liu
  1 sibling, 1 reply; 7+ messages in thread
From: Dave Chinner @ 2013-01-11 22:52 UTC (permalink / raw)
  To: Jeff Liu; +Cc: Abhijit Pawar, Ben Myers, Alex Elder, linux-kernel, xfs

On Fri, Jan 11, 2013 at 02:36:46PM +0800, Jeff Liu wrote:
> On 01/09/2013 10:04 PM, Abhijit Pawar wrote:
> > This patch replaces usages of obsolete simple_strtoul with kstrtoint in xfs_args and suffix_strtoul.
> > 
> > Signed-off-by: Abhijit Pawar <abhi.c.pawar@gmail.com>
> > ---
> > +			if (kstrtoint(value, 10, &dswidth))
> > +				return EINVAL;
> >  		} else if (!strcmp(this_char, MNTOPT_32BITINODE)) {
> >  			mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
> >  		} else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
> > 
> checkpatch.pl show warning if we return EINVAL as below:
> WARNING: return of an errno should typically be -ve (return -EINVAL)
> 
> Can we just ignore such code style issue?

Returning a positive error is not a code style issue. It's a
correctness issue. the core of the XFS code returns positive error
numbers as that's the way it was done on Irix (where the XFs code
comes from). The rest of the Linux code tends to use negative values
for error returns, and we've never converted the XFS code base to
negative errors.

You should always feel free to ignore checkpatch warnings that make
no sense. I haven't used checkpatch now for several years - I
stopped using it when it got too noisy warning about uselesss,
trivial things in the XFS code base....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] fs/xfs remove obsolete simple_strto<foo>
  2013-01-11 22:52   ` Dave Chinner
@ 2013-01-12  2:48     ` Jeff Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff Liu @ 2013-01-12  2:48 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Abhijit Pawar, Ben Myers, Alex Elder, linux-kernel, xfs

On 01/12/2013 06:52 AM, Dave Chinner wrote:
> On Fri, Jan 11, 2013 at 02:36:46PM +0800, Jeff Liu wrote:
>> On 01/09/2013 10:04 PM, Abhijit Pawar wrote:
>>> This patch replaces usages of obsolete simple_strtoul with kstrtoint in xfs_args and suffix_strtoul.
>>>
>>> Signed-off-by: Abhijit Pawar <abhi.c.pawar@gmail.com>
>>> ---
>>> +			if (kstrtoint(value, 10, &dswidth))
>>> +				return EINVAL;
>>>  		} else if (!strcmp(this_char, MNTOPT_32BITINODE)) {
>>>  			mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
>>>  		} else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
>>>
>> checkpatch.pl show warning if we return EINVAL as below:
>> WARNING: return of an errno should typically be -ve (return -EINVAL)
>>
>> Can we just ignore such code style issue?
> 
> Returning a positive error is not a code style issue. It's a
> correctness issue. the core of the XFS code returns positive error
> numbers as that's the way it was done on Irix (where the XFs code
> comes from). The rest of the Linux code tends to use negative values
> for error returns, and we've never converted the XFS code base to
> negative errors.
> 
> You should always feel free to ignore checkpatch warnings that make
> no sense. I haven't used checkpatch now for several years - I
> stopped using it when it got too noisy warning about uselesss,
> trivial things in the XFS code base....
Thanks for the clarification, that would save me time to handle
checkpatch warnings against XFS in the future. :)

Cheers,
-Jeff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] fs/xfs remove obsolete simple_strto<foo>
  2013-01-09 14:04 [PATCH 1/1] fs/xfs remove obsolete simple_strto<foo> Abhijit Pawar
  2013-01-11  6:36 ` Jeff Liu
@ 2013-01-12  2:54 ` Jeff Liu
  1 sibling, 0 replies; 7+ messages in thread
From: Jeff Liu @ 2013-01-12  2:54 UTC (permalink / raw)
  To: Abhijit Pawar; +Cc: Ben Myers, Alex Elder, linux-kernel, xfs

On 01/09/2013 10:04 PM, Abhijit Pawar wrote:
> This patch replaces usages of obsolete simple_strtoul with kstrtoint in xfs_args and suffix_strtoul.
> 
> Signed-off-by: Abhijit Pawar <abhi.c.pawar@gmail.com>
> ---
>  fs/xfs/xfs_super.c |   29 +++++++++++++++++++----------
>  1 files changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index ab8839b..c407121 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -139,9 +139,9 @@ static const match_table_t tokens = {
>  
>  
>  STATIC unsigned long
> -suffix_strtoul(char *s, char **endp, unsigned int base)
> +suffix_kstrtoint(char *s, unsigned int base, int *res)
>  {
> -	int	last, shift_left_factor = 0;
> +	int	last, shift_left_factor = 0, _res;
>  	char	*value = s;
>  
>  	last = strlen(value) - 1;
> @@ -158,7 +158,10 @@ suffix_strtoul(char *s, char **endp, unsigned int base)
>  		value[last] = '\0';
>  	}
>  
> -	return simple_strtoul((const char *)s, endp, base) << shift_left_factor;
> +	if (kstrtoint(s, base, &_res))
> +		return -EINVAL;
> +	*res = _res << shift_left_factor;
> +	return 0;
>  }
>  
>  /*
> @@ -174,7 +177,7 @@ xfs_parseargs(
>  	char			*options)
>  {
>  	struct super_block	*sb = mp->m_super;
> -	char			*this_char, *value, *eov;
> +	char			*this_char, *value;
>  	int			dsunit = 0;
>  	int			dswidth = 0;
>  	int			iosize = 0;
> @@ -230,14 +233,16 @@ xfs_parseargs(
>  					this_char);
>  				return EINVAL;
>  			}
> -			mp->m_logbufs = simple_strtoul(value, &eov, 10);
> +			if (kstrtoint(value, 10, &mp->m_logbufs))
> +				return EINVAL;
>  		} else if (!strcmp(this_char, MNTOPT_LOGBSIZE)) {
>  			if (!value || !*value) {
>  				xfs_warn(mp, "%s option requires an argument",
>  					this_char);
>  				return EINVAL;
>  			}
> -			mp->m_logbsize = suffix_strtoul(value, &eov, 10);
> +			if (suffix_kstrtoint(value, 10, &mp->m_logbsize))
> +				return EINVAL;
>  		} else if (!strcmp(this_char, MNTOPT_LOGDEV)) {
>  			if (!value || !*value) {
>  				xfs_warn(mp, "%s option requires an argument",
> @@ -266,7 +271,8 @@ xfs_parseargs(
>  					this_char);
>  				return EINVAL;
>  			}
> -			iosize = simple_strtoul(value, &eov, 10);
> +			if (kstrtoint(value, 10, &iosize))
> +				return EINVAL;
>  			iosizelog = ffs(iosize) - 1;
>  		} else if (!strcmp(this_char, MNTOPT_ALLOCSIZE)) {
>  			if (!value || !*value) {
> @@ -274,7 +280,8 @@ xfs_parseargs(
>  					this_char);
>  				return EINVAL;
>  			}
> -			iosize = suffix_strtoul(value, &eov, 10);
> +			if (suffix_kstrtoint(value, 10, &iosize))
> +				return EINVAL;
>  			iosizelog = ffs(iosize) - 1;
>  		} else if (!strcmp(this_char, MNTOPT_GRPID) ||
>  			   !strcmp(this_char, MNTOPT_BSDGROUPS)) {
> @@ -296,14 +303,16 @@ xfs_parseargs(
>  					this_char);
>  				return EINVAL;
>  			}
> -			dsunit = simple_strtoul(value, &eov, 10);
> +			if (kstrtoint(value, 10, &dsunit))
> +				return EINVAL;
>  		} else if (!strcmp(this_char, MNTOPT_SWIDTH)) {
>  			if (!value || !*value) {
>  				xfs_warn(mp, "%s option requires an argument",
>  					this_char);
>  				return EINVAL;
>  			}
> -			dswidth = simple_strtoul(value, &eov, 10);
> +			if (kstrtoint(value, 10, &dswidth))
> +				return EINVAL;
>  		} else if (!strcmp(this_char, MNTOPT_32BITINODE)) {
>  			mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
>  		} else if (!strcmp(this_char, MNTOPT_64BITINODE)) {
> 
Reviewed-by: Jie Liu <jeff.liu@oracle.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-12  2:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-09 14:04 [PATCH 1/1] fs/xfs remove obsolete simple_strto<foo> Abhijit Pawar
2013-01-11  6:36 ` Jeff Liu
2013-01-11  7:46   ` Abhijit Pawar
2013-01-11 19:09     ` Ben Myers
2013-01-11 22:52   ` Dave Chinner
2013-01-12  2:48     ` Jeff Liu
2013-01-12  2:54 ` Jeff Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox