fs/jfs/super.c: convert simple_str to kstr

This patch replaces obsolete simple_str functions by kstr

use kstrtouint for
-uid_t ( __kernel_uid32_t )
-gid_t ( __kernel_gid32_t )
-jfs_sb_info->umask
-jfs_sb_info->minblks_trim
(all unsigned int)

newLVSize is s64 -> use kstrtol

Current parse_options behaviour stays the same ie it doesn't return kstr
rc but just 0 if function failed (parse_options callsites
return -EINVAL when there's anything wrong).

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Fabian Frederick 2014-05-21 20:29:29 +02:00 committed by Dave Kleikamp
parent 4f65b6dbc7
commit bb5e50aaa8
1 changed files with 24 additions and 8 deletions

View File

@ -272,7 +272,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
case Opt_resize: case Opt_resize:
{ {
char *resize = args[0].from; char *resize = args[0].from;
*newLVSize = simple_strtoull(resize, &resize, 0); int rc = kstrtoll(resize, 0, newLVSize);
if (rc)
goto cleanup;
break; break;
} }
case Opt_resize_nosize: case Opt_resize_nosize:
@ -326,7 +329,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
case Opt_uid: case Opt_uid:
{ {
char *uid = args[0].from; char *uid = args[0].from;
uid_t val = simple_strtoul(uid, &uid, 0); uid_t val;
int rc = kstrtouint(uid, 0, &val);
if (rc)
goto cleanup;
sbi->uid = make_kuid(current_user_ns(), val); sbi->uid = make_kuid(current_user_ns(), val);
if (!uid_valid(sbi->uid)) if (!uid_valid(sbi->uid))
goto cleanup; goto cleanup;
@ -336,7 +343,11 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
case Opt_gid: case Opt_gid:
{ {
char *gid = args[0].from; char *gid = args[0].from;
gid_t val = simple_strtoul(gid, &gid, 0); gid_t val;
int rc = kstrtouint(gid, 0, &val);
if (rc)
goto cleanup;
sbi->gid = make_kgid(current_user_ns(), val); sbi->gid = make_kgid(current_user_ns(), val);
if (!gid_valid(sbi->gid)) if (!gid_valid(sbi->gid))
goto cleanup; goto cleanup;
@ -346,7 +357,10 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
case Opt_umask: case Opt_umask:
{ {
char *umask = args[0].from; char *umask = args[0].from;
sbi->umask = simple_strtoul(umask, &umask, 8); int rc = kstrtouint(umask, 8, &sbi->umask);
if (rc)
goto cleanup;
if (sbi->umask & ~0777) { if (sbi->umask & ~0777) {
pr_err("JFS: Invalid value of umask\n"); pr_err("JFS: Invalid value of umask\n");
goto cleanup; goto cleanup;
@ -377,13 +391,15 @@ static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
{ {
struct request_queue *q = bdev_get_queue(sb->s_bdev); struct request_queue *q = bdev_get_queue(sb->s_bdev);
char *minblks_trim = args[0].from; char *minblks_trim = args[0].from;
int rc;
if (blk_queue_discard(q)) { if (blk_queue_discard(q)) {
*flag |= JFS_DISCARD; *flag |= JFS_DISCARD;
sbi->minblks_trim = simple_strtoull( rc = kstrtouint(minblks_trim, 0,
minblks_trim, &minblks_trim, 0); &sbi->minblks_trim);
} else { if (rc)
goto cleanup;
} else
pr_err("JFS: discard option not supported on device\n"); pr_err("JFS: discard option not supported on device\n");
}
break; break;
} }