aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2015-07-20 08:57:12 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2015-07-22 14:31:48 +1000
commitd2c05ecd59bc2a424e24f45b29761a4b5ddc0de3 (patch)
treed40b9dd967a6a10ecc32cf675ebcdb15472f82d9
parentca525adced70b6e76aa9f075d38eb71e83e0a936 (diff)
parse_integer: convert ext2, ext3, ext4
Convert away from deprecated simple_strto*() interfaces. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jan Kara <jack@suse.cz> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--fs/ext2/super.c6
-rw-r--r--fs/ext3/super.c7
-rw-r--r--fs/ext4/super.c15
3 files changed, 15 insertions, 13 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 900e19cf9ef6..a08ac730a38f 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -383,16 +383,18 @@ static unsigned long get_sb_block(void **data)
{
unsigned long sb_block;
char *options = (char *) *data;
+ int rv;
if (!options || strncmp(options, "sb=", 3) != 0)
return 1; /* Default location */
options += 3;
- sb_block = simple_strtoul(options, &options, 0);
- if (*options && *options != ',') {
+ rv = parse_integer(options, 0, &sb_block);
+ if (rv < 0 || (options[rv] && options[rv] != ',')) {
printk("EXT2-fs: Invalid sb specification: %s\n",
(char *) *data);
return 1;
}
+ options += rv;
if (*options == ',')
options++;
*data = (void *) options;
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index 5ed0044fbb37..9b6479dfb02e 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -902,17 +902,18 @@ static ext3_fsblk_t get_sb_block(void **data, struct super_block *sb)
{
ext3_fsblk_t sb_block;
char *options = (char *) *data;
+ int rv;
if (!options || strncmp(options, "sb=", 3) != 0)
return 1; /* Default location */
options += 3;
- /*todo: use simple_strtoll with >32bit ext3 */
- sb_block = simple_strtoul(options, &options, 0);
- if (*options && *options != ',') {
+ rv = parse_integer(options, 0, &sb_block);
+ if (rv < 0 || (options[rv] && options[rv] != ',')) {
ext3_msg(sb, KERN_ERR, "error: invalid sb specification: %s",
(char *) *data);
return 1;
}
+ options += rv;
if (*options == ',')
options++;
*data = (void *) options;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 58987b5c514b..a3ed1eb4fe62 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1238,18 +1238,19 @@ static ext4_fsblk_t get_sb_block(void **data)
{
ext4_fsblk_t sb_block;
char *options = (char *) *data;
+ int rv;
if (!options || strncmp(options, "sb=", 3) != 0)
return 1; /* Default location */
options += 3;
- /* TODO: use simple_strtoll with >32bit ext4 */
- sb_block = simple_strtoul(options, &options, 0);
- if (*options && *options != ',') {
+ rv = parse_integer(options, 0, &sb_block);
+ if (rv < 0 || (options[rv] && options[rv] != ',')) {
printk(KERN_ERR "EXT4-fs: Invalid sb specification: %s\n",
(char *) *data);
return 1;
}
+ options += rv;
if (*options == ',')
options++;
*data = (void *) options;
@@ -2519,10 +2520,10 @@ static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
struct ext4_sb_info *sbi,
const char *buf, size_t count)
{
- unsigned long t;
+ unsigned int t;
int ret;
- ret = kstrtoul(skip_spaces(buf), 0, &t);
+ ret = kstrtouint(skip_spaces(buf), 0, &t);
if (ret)
return ret;
@@ -2546,13 +2547,11 @@ static ssize_t sbi_ui_store(struct ext4_attr *a,
const char *buf, size_t count)
{
unsigned int *ui = (unsigned int *) (((char *) sbi) + a->u.offset);
- unsigned long t;
int ret;
- ret = kstrtoul(skip_spaces(buf), 0, &t);
+ ret = kstrtouint(skip_spaces(buf), 0, ui);
if (ret)
return ret;
- *ui = t;
return count;
}