mm/mem-hotplug: replace simple_strtoul() with kstrtoul()
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 mm/mem-hotplug: replace simple_strtoul() with kstrtoul()
use the newer and more pleasant kstrtoul() to replace simple_strtoul(), because simple_strtoul() is marked for obsoletion.
--- drivers/base/memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/base/memory.c +3 -1
@@ -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 ;
Signature · 13 lines
1.8.1.2 . -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Zhang Zhen
drivers/base/memory.c +0
-0
drivers/base/memory.c memory_probe_store(struct device *dev, struct device_attribute *attr, · line 414
Quoted 10 lines
drivers/base/memory.c +3
-1@@ -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 [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 23 lines · David Rientjes
Quoted 5 lines · Zhang Zhen
drivers/base/memory.c +0
-0drivers/base/memory.c memory_probe_store(struct device *dev, struct device_attribute *attr, · line 414
Quoted 10 lines
drivers/base/memory.c +3
-1@@ -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,
Quoted 8 lines
- this disregards the error returned by
kstrtoull()and returns-EINVALfor all possible errors,kstrtoull()returns other errors as well, and- the patch title in the subject line refers to
simple_strtoul()andkstrtoul()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!
Quoted 1 line
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>