All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Marcin Ciupak <marcin.s.ciupak@gmail.com>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Oleg Drokin <oleg.drokin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH v2] staging: lustre: replace simple_strtoul with kstrtoint
Date: Fri, 14 Apr 2017 10:16:31 +0200	[thread overview]
Message-ID: <20170414081631.GC16598@kroah.com> (raw)
In-Reply-To: <20170321124609.GA3896@gentoo>

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

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Marcin Ciupak <marcin.s.ciupak@gmail.com>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Oleg Drokin <oleg.drokin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	lustre-devel@lists.lustre.org
Subject: Re: [PATCH v2] staging: lustre: replace simple_strtoul with kstrtoint
Date: Fri, 14 Apr 2017 10:16:31 +0200	[thread overview]
Message-ID: <20170414081631.GC16598@kroah.com> (raw)
In-Reply-To: <20170321124609.GA3896@gentoo>

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

  reply	other threads:[~2017-04-14  8:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 12:46 [PATCH v2] staging: lustre: replace simple_strtoul with kstrtoint Marcin Ciupak
2017-04-14  8:16 ` Greg Kroah-Hartman [this message]
2017-04-14  8:16   ` Greg Kroah-Hartman
2017-07-27 10:59   ` [lustre-devel] " Marcin Ciupak
2017-07-27 10:59     ` Marcin Ciupak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170414081631.GC16598@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=marcin.s.ciupak@gmail.com \
    --cc=oleg.drokin@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.