[PATCH] ubifs: replace simple_strtoul() with kstrtoul()
Zhang Zhen
zhenzhang.zhang at huawei.com
Sun May 18 20:26:33 PDT 2014
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 at huawei.com>
---
fs/ubifs/super.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index a81c7b5..a30f297 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1905,6 +1905,7 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode)
struct ubi_volume_desc *ubi;
int dev, vol;
char *endptr;
+ int ret;
/* First, try to open using the device node path method */
ubi = ubi_open_volume_path(name, mode);
@@ -1922,7 +1923,10 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode)
if (!isdigit(name[3]))
return ERR_PTR(-EINVAL);
- dev = simple_strtoul(name + 3, &endptr, 0);
+ endptr = (char *)name + 3;
+ ret = kstrtoul(endptr, 0, (unsigned long *)&dev);
+ if (ret)
+ return ERR_PTR(-EINVAL);
/* ubiY method */
if (*endptr == '\0')
@@ -1930,7 +1934,10 @@ static struct ubi_volume_desc *open_ubi(const char *name, int mode)
/* ubiX_Y method */
if (*endptr == '_' && isdigit(endptr[1])) {
- vol = simple_strtoul(endptr + 1, &endptr, 0);
+ endptr = endptr + 1;
+ ret = kstrtoul(endptr, 0, (unsigned long *)&vol);
+ if (ret)
+ return ERR_PTR(-EINVAL);
if (*endptr != '\0')
return ERR_PTR(-EINVAL);
return ubi_open_volume(dev, vol, mode);
--
1.8.1.2
.
More information about the linux-mtd
mailing list