* [PATCH] mm/mem-hotplug: replace simple_strtoul() with kstrtoul()
[not found] <1403151749-14013-1-git-send-email-zhenzhang.zhang@huawei.com>
@ 2014-06-19 7:50 ` Zhang Zhen
2014-06-19 8:31 ` David Rientjes
0 siblings, 1 reply; 3+ messages in thread
From: Zhang Zhen @ 2014-06-19 7:50 UTC (permalink / raw)
To: nfont, akpm; +Cc: linux-mm
use the newer and more pleasant kstrtoul() to replace simple_strtoul(),
because simple_strtoul() is marked for obsoletion.
Signed-off-by: Zhang Zhen <zhenzhang.zhang@huawei.com>
---
drivers/base/memory.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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;
--
1.8.1.2
.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/mem-hotplug: replace simple_strtoul() with kstrtoul()
2014-06-19 7:50 ` [PATCH] mm/mem-hotplug: replace simple_strtoul() with kstrtoul() Zhang Zhen
@ 2014-06-19 8:31 ` David Rientjes
2014-06-19 9:26 ` Zhang Zhen
0 siblings, 1 reply; 3+ messages in thread
From: David Rientjes @ 2014-06-19 8:31 UTC (permalink / raw)
To: Zhang Zhen; +Cc: nfont, akpm, linux-mm
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@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm/mem-hotplug: replace simple_strtoul() with kstrtoul()
2014-06-19 8:31 ` David Rientjes
@ 2014-06-19 9:26 ` Zhang Zhen
0 siblings, 0 replies; 3+ messages in thread
From: Zhang Zhen @ 2014-06-19 9:26 UTC (permalink / raw)
To: David Rientjes; +Cc: nfont, akpm, linux-mm
On 2014/6/19 16:31, David Rientjes wrote:
> 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.
>
Sorry, i had made a silly mistake. I will fix and resubmit.
Thanks!
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-19 9:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1403151749-14013-1-git-send-email-zhenzhang.zhang@huawei.com>
2014-06-19 7:50 ` [PATCH] mm/mem-hotplug: replace simple_strtoul() with kstrtoul() Zhang Zhen
2014-06-19 8:31 ` David Rientjes
2014-06-19 9:26 ` Zhang Zhen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).