public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jingoo Han <jg1.han@samsung.com>
To: "'Greg Kroah-Hartman'" <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, Jingoo Han <jg1.han@samsung.com>
Subject: Re: [PATCH] driver core: replace strict_strto*() with kstrto*()
Date: Fri, 26 Jul 2013 12:43:43 +0900	[thread overview]
Message-ID: <000101ce89b2$5378c210$fa6a4630$@samsung.com> (raw)
In-Reply-To: <001a01ce8450$dcbd0bb0$96372310$@samsung.com>

On Fri, Jul 19, 2013 at 04:21:28PM +0900, Jingoo Han wrote:, Jingoo Han wrote:
> 
> The usage of strict_strto*() is not preferred, because
> strict_strto*() is obsolete. Thus, kstrto*() should be
> used.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
>  drivers/base/core.c                  |    2 +-
>  drivers/base/memory.c                |   10 ++++++----
>  drivers/base/power/sysfs.c           |    7 ++++++-
>  drivers/base/regmap/regmap-debugfs.c |    5 +++--
>  4 files changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 8856d74..edfbf05 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -38,7 +38,7 @@ long sysfs_deprecated = 0;
>  #endif
>  static __init int sysfs_deprecated_setup(char *arg)
>  {
> -	return strict_strtol(arg, 10, &sysfs_deprecated);
> +	return kstrtol(arg, 10, &sysfs_deprecated);
>  }
>  early_param("sysfs.deprecated", sysfs_deprecated_setup);
>  #endif
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index 2b7813e..d0817fb 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -469,8 +469,9 @@ store_soft_offline_page(struct device *dev,
>  	u64 pfn;
>  	if (!capable(CAP_SYS_ADMIN))
>  		return -EPERM;
> -	if (strict_strtoull(buf, 0, &pfn) < 0)
> -		return -EINVAL;
> +	ret = kstrtoull(buf, 0, &pfn);
> +	if (ret < 0)
> +		return ret;

In order to not risk any user space breakage,
I will just mechanically replaces strict_strto*() with kstrto*().


>  	pfn >>= PAGE_SHIFT;
>  	if (!pfn_valid(pfn))
>  		return -ENXIO;
> @@ -488,8 +489,9 @@ store_hard_offline_page(struct device *dev,
>  	u64 pfn;
>  	if (!capable(CAP_SYS_ADMIN))
>  		return -EPERM;
> -	if (strict_strtoull(buf, 0, &pfn) < 0)
> -		return -EINVAL;
> +	ret = kstrtoull(buf, 0, &pfn);
> +	if (ret < 0)
> +		return ret;

Ditto.

>  	pfn >>= PAGE_SHIFT;
>  	ret = memory_failure(pfn, 0, 0);
>  	return ret ? ret : count;
> diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
> index a53ebd2..e0a3877 100644
> --- a/drivers/base/power/sysfs.c
> +++ b/drivers/base/power/sysfs.c
> @@ -202,11 +202,16 @@ static ssize_t autosuspend_delay_ms_store(struct device *dev,
>  		struct device_attribute *attr, const char *buf, size_t n)
>  {
>  	long delay;
> +	int ret;
> 
>  	if (!dev->power.use_autosuspend)
>  		return -EIO;
> 
> -	if (strict_strtol(buf, 10, &delay) != 0 || delay != (int) delay)
> +	ret = kstrtol(buf, 10, &delay);
> +	if (ret)
> +		return ret;
> +
> +	if (delay != (int) delay)

Ditto.

>  		return -EINVAL;
> 
>  	device_lock(dev);
> diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c
> index 5349575..664a75e 100644
> --- a/drivers/base/regmap/regmap-debugfs.c
> +++ b/drivers/base/regmap/regmap-debugfs.c
> @@ -281,8 +281,9 @@ static ssize_t regmap_map_write_file(struct file *file,
>  	reg = simple_strtoul(start, &start, 16);
>  	while (*start == ' ')
>  		start++;
> -	if (strict_strtoul(start, 16, &value))
> -		return -EINVAL;
> +	ret = kstrtoul(start, 16, &value);
> +	if (ret)
> +		return ret;

Ditto.

I will send v2 patch, soon.
Thank you.

Best regards,
Jingoo Han

> 
>  	/* Userspace has been fiddling around behind the kernel's back */
>  	add_taint(TAINT_USER, LOCKDEP_STILL_OK);
> --
> 1.7.10.4



      reply	other threads:[~2013-07-26  3:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19  7:23 [PATCH] driver core: replace strict_strto*() with kstrto*() Jingoo Han
2013-07-26  3:43 ` Jingoo Han [this message]

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='000101ce89b2$5378c210$fa6a4630$@samsung.com' \
    --to=jg1.han@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox