lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <000101ce89b2$5378c210$fa6a4630$@samsung.com>
Date:	Fri, 26 Jul 2013 12:43:43 +0900
From:	Jingoo Han <jg1.han@...sung.com>
To:	'Greg Kroah-Hartman' <gregkh@...uxfoundation.org>
Cc:	linux-kernel@...r.kernel.org, Jingoo Han <jg1.han@...sung.com>
Subject: Re: [PATCH] driver core: replace strict_strto*() with kstrto*()

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@...sung.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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ