Re: [PATCH] mm/mem-hotplug: replace simple_strtoul() with kstrtoul()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 19 Jun 2014, Zhang Zhen wrote:

> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index 89f752d..c1b118a 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -406,7 +406,9 @@ memory_probe_store(struct device *dev, struct device_attribute *attr,
>  	int i, ret;
>  	unsigned long pages_per_block = PAGES_PER_SECTION * sections_per_block;
> 
> -	phys_addr = simple_strtoull(buf, NULL, 0);
> +	ret = kstrtoull(buf, 0, phys_addr);
> +	if (ret)
> +		return -EINVAL;
> 
>  	if (phys_addr & ((pages_per_block << PAGE_SHIFT) - 1))
>  		return -EINVAL;

Three issues:

 - this isn't compile tested, one of your parameters to kstrtoull() has 
   the wrong type,

 - this disregards the error returned by kstrtoull() and returns -EINVAL 
   for all possible errors, kstrtoull() returns other errors as well, and

 - the patch title in the subject line refers to simple_strtoul() and
   kstrtoul() which do not appear in your patch.

Please fix issues and resubmit.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]