All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: lustre: replace simple_strtoul with kstrtoint
@ 2017-03-21 12:46 Marcin Ciupak
  2017-04-14  8:16   ` [lustre-devel] " Greg Kroah-Hartman
  0 siblings, 1 reply; 5+ messages in thread
From: Marcin Ciupak @ 2017-03-21 12:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Andreas Dilger, James Simmons, Oleg Drokin, lustre-devel, devel,
	linux-kernel

Replace simple_strtoul with kstrtoint.
simple_strtoul is marked for obsoletion as reported by checkpatch.pl

Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
---
v2:
	-improving kstrtoint error handling
	-updating commit message

 drivers/staging/lustre/lustre/obdclass/obd_mount.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index 8e0d4b1d86dc..42858ee5b444 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -924,12 +924,20 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)
 			lmd->lmd_flags |= LMD_FLG_ABORT_RECOV;
 			clear++;
 		} else if (strncmp(s1, "recovery_time_soft=", 19) == 0) {
-			lmd->lmd_recovery_time_soft = max_t(int,
-				simple_strtoul(s1 + 19, NULL, 10), time_min);
+			int res;
+
+			rc = kstrtoint(s1 + 19, 10, &res);
+			if (rc)
+				goto invalid;
+			lmd->lmd_recovery_time_soft = max_t(int, res, time_min);
 			clear++;
 		} else if (strncmp(s1, "recovery_time_hard=", 19) == 0) {
-			lmd->lmd_recovery_time_hard = max_t(int,
-				simple_strtoul(s1 + 19, NULL, 10), time_min);
+			int res;
+
+			rc = kstrtoint(s1 + 19, 10, &res);
+			if (rc)
+				goto invalid;
+			lmd->lmd_recovery_time_hard = max_t(int, res, time_min);
 			clear++;
 		} else if (strncmp(s1, "noir", 4) == 0) {
 			lmd->lmd_flags |= LMD_FLG_NOIR; /* test purpose only. */
-- 
2.11.1

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

* Re: [PATCH v2] staging: lustre: replace simple_strtoul with kstrtoint
  2017-03-21 12:46 [PATCH v2] staging: lustre: replace simple_strtoul with kstrtoint Marcin Ciupak
@ 2017-04-14  8:16   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2017-04-14  8:16 UTC (permalink / raw)
  To: Marcin Ciupak
  Cc: devel, linux-kernel, Oleg Drokin, Andreas Dilger, lustre-devel

On Tue, Mar 21, 2017 at 01:46:09PM +0100, Marcin Ciupak wrote:
> Replace simple_strtoul with kstrtoint.
> simple_strtoul is marked for obsoletion as reported by checkpatch.pl
> 
> Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
> ---
> v2:
> 	-improving kstrtoint error handling
> 	-updating commit message
> 
>  drivers/staging/lustre/lustre/obdclass/obd_mount.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> index 8e0d4b1d86dc..42858ee5b444 100644
> --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> @@ -924,12 +924,20 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)
>  			lmd->lmd_flags |= LMD_FLG_ABORT_RECOV;
>  			clear++;
>  		} else if (strncmp(s1, "recovery_time_soft=", 19) == 0) {
> -			lmd->lmd_recovery_time_soft = max_t(int,
> -				simple_strtoul(s1 + 19, NULL, 10), time_min);
> +			int res;
> +
> +			rc = kstrtoint(s1 + 19, 10, &res);
> +			if (rc)
> +				goto invalid;
> +			lmd->lmd_recovery_time_soft = max_t(int, res, time_min);

Are you sure max_t is still needed here?

And have you tested this change?

thanks,

greg k-h

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

* [lustre-devel] [PATCH v2] staging: lustre: replace simple_strtoul with kstrtoint
@ 2017-04-14  8:16   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2017-04-14  8:16 UTC (permalink / raw)
  To: Marcin Ciupak
  Cc: devel, linux-kernel, Oleg Drokin, Andreas Dilger, lustre-devel

On Tue, Mar 21, 2017 at 01:46:09PM +0100, Marcin Ciupak wrote:
> Replace simple_strtoul with kstrtoint.
> simple_strtoul is marked for obsoletion as reported by checkpatch.pl
> 
> Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
> ---
> v2:
> 	-improving kstrtoint error handling
> 	-updating commit message
> 
>  drivers/staging/lustre/lustre/obdclass/obd_mount.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> index 8e0d4b1d86dc..42858ee5b444 100644
> --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> @@ -924,12 +924,20 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)
>  			lmd->lmd_flags |= LMD_FLG_ABORT_RECOV;
>  			clear++;
>  		} else if (strncmp(s1, "recovery_time_soft=", 19) == 0) {
> -			lmd->lmd_recovery_time_soft = max_t(int,
> -				simple_strtoul(s1 + 19, NULL, 10), time_min);
> +			int res;
> +
> +			rc = kstrtoint(s1 + 19, 10, &res);
> +			if (rc)
> +				goto invalid;
> +			lmd->lmd_recovery_time_soft = max_t(int, res, time_min);

Are you sure max_t is still needed here?

And have you tested this change?

thanks,

greg k-h

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

* Re: [PATCH v2] staging: lustre: replace simple_strtoul with kstrtoint
  2017-04-14  8:16   ` [lustre-devel] " Greg Kroah-Hartman
@ 2017-07-27 10:59     ` Marcin Ciupak
  -1 siblings, 0 replies; 5+ messages in thread
From: Marcin Ciupak @ 2017-07-27 10:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Oleg Drokin, Andreas Dilger, lustre-devel

I did test it and not everything works as expected. I
need to reconsider that change. Please drop this patch.

Thanks,
Marcin

P.S. Sorry for late (sic!) response.

On Fri, Apr 14, 2017 at 10:16:31AM +0200, Greg Kroah-Hartman wrote:
> On Tue, Mar 21, 2017 at 01:46:09PM +0100, Marcin Ciupak wrote:
> > Replace simple_strtoul with kstrtoint.
> > simple_strtoul is marked for obsoletion as reported by checkpatch.pl
> > 
> > Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
> > ---
> > v2:
> > 	-improving kstrtoint error handling
> > 	-updating commit message
> > 
> >  drivers/staging/lustre/lustre/obdclass/obd_mount.c | 16 ++++++++++++----
> >  1 file changed, 12 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> > index 8e0d4b1d86dc..42858ee5b444 100644
> > --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> > +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> > @@ -924,12 +924,20 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)
> >  			lmd->lmd_flags |= LMD_FLG_ABORT_RECOV;
> >  			clear++;
> >  		} else if (strncmp(s1, "recovery_time_soft=", 19) == 0) {
> > -			lmd->lmd_recovery_time_soft = max_t(int,
> > -				simple_strtoul(s1 + 19, NULL, 10), time_min);
> > +			int res;
> > +
> > +			rc = kstrtoint(s1 + 19, 10, &res);
> > +			if (rc)
> > +				goto invalid;
> > +			lmd->lmd_recovery_time_soft = max_t(int, res, time_min);
> 
> Are you sure max_t is still needed here?
> 
> And have you tested this change?
> 
> thanks,
> 
> greg k-h

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

* [lustre-devel] [PATCH v2] staging: lustre: replace simple_strtoul with kstrtoint
@ 2017-07-27 10:59     ` Marcin Ciupak
  0 siblings, 0 replies; 5+ messages in thread
From: Marcin Ciupak @ 2017-07-27 10:59 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: devel, linux-kernel, Oleg Drokin, Andreas Dilger, lustre-devel

I did test it and not everything works as expected. I
need to reconsider that change. Please drop this patch.

Thanks,
Marcin

P.S. Sorry for late (sic!) response.

On Fri, Apr 14, 2017 at 10:16:31AM +0200, Greg Kroah-Hartman wrote:
> On Tue, Mar 21, 2017 at 01:46:09PM +0100, Marcin Ciupak wrote:
> > Replace simple_strtoul with kstrtoint.
> > simple_strtoul is marked for obsoletion as reported by checkpatch.pl
> > 
> > Signed-off-by: Marcin Ciupak <marcin.s.ciupak@gmail.com>
> > ---
> > v2:
> > 	-improving kstrtoint error handling
> > 	-updating commit message
> > 
> >  drivers/staging/lustre/lustre/obdclass/obd_mount.c | 16 ++++++++++++----
> >  1 file changed, 12 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> > index 8e0d4b1d86dc..42858ee5b444 100644
> > --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> > +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
> > @@ -924,12 +924,20 @@ static int lmd_parse(char *options, struct lustre_mount_data *lmd)
> >  			lmd->lmd_flags |= LMD_FLG_ABORT_RECOV;
> >  			clear++;
> >  		} else if (strncmp(s1, "recovery_time_soft=", 19) == 0) {
> > -			lmd->lmd_recovery_time_soft = max_t(int,
> > -				simple_strtoul(s1 + 19, NULL, 10), time_min);
> > +			int res;
> > +
> > +			rc = kstrtoint(s1 + 19, 10, &res);
> > +			if (rc)
> > +				goto invalid;
> > +			lmd->lmd_recovery_time_soft = max_t(int, res, time_min);
> 
> Are you sure max_t is still needed here?
> 
> And have you tested this change?
> 
> thanks,
> 
> greg k-h

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

end of thread, other threads:[~2017-07-27 10:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21 12:46 [PATCH v2] staging: lustre: replace simple_strtoul with kstrtoint Marcin Ciupak
2017-04-14  8:16 ` Greg Kroah-Hartman
2017-04-14  8:16   ` [lustre-devel] " Greg Kroah-Hartman
2017-07-27 10:59   ` Marcin Ciupak
2017-07-27 10:59     ` [lustre-devel] " Marcin Ciupak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.