From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752183AbbEBBDq (ORCPT ); Fri, 1 May 2015 21:03:46 -0400 Received: from mail-wg0-f51.google.com ([74.125.82.51]:36678 "EHLO mail-wg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750934AbbEBBDo (ORCPT ); Fri, 1 May 2015 21:03:44 -0400 Date: Sat, 2 May 2015 04:03:41 +0300 From: Alexey Dobriyan To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, tytso@mit.edu Subject: [PATCH 10/10] ext2, ext3, ext4: convert to parse_integer()/kstrto*() Message-ID: <20150502010340.GJ21655@p183.telecom.by> References: <20150502004714.GA21655@p183.telecom.by> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150502004714.GA21655@p183.telecom.by> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Convert away from deprecated simple_strto*() interfaces. Signed-off-by: Alexey Dobriyan --- fs/ext2/super.c | 6 ++++-- fs/ext3/super.c | 7 ++++--- fs/ext4/super.c | 15 +++++++-------- 3 files changed, 15 insertions(+), 13 deletions(-) --- 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; --- 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; --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1210,18 +1210,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; @@ -2491,10 +2492,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; @@ -2518,13 +2519,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; }