Skip to content

Commit fd8a620

Browse files
Su HuiMikulas Patocka
authored andcommitted
hpfs: Replace simple_strtoul with kstrtoint in hpfs_parse_param
kstrtoint() is better because simple_strtoul() ignores overflow and the type of 'timeshift' is 'int' rather than 'unsigned long'. Using kstrtoint() is more concise too. Signed-off-by: Su Hui <[email protected]> Signed-off-by: Mikulas Patocka <[email protected]>
1 parent 68a7449 commit fd8a620

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

fs/hpfs/super.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -404,15 +404,11 @@ static int hpfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
404404
break;
405405
case Opt_timeshift:
406406
{
407-
int m = 1;
408407
char *rhs = param->string;
409408
int timeshift;
410409

411-
if (*rhs == '-') m = -1;
412-
if (*rhs == '+' || *rhs == '-') rhs++;
413-
timeshift = simple_strtoul(rhs, &rhs, 0) * m;
414-
if (*rhs)
415-
return -EINVAL;
410+
if (kstrtoint(rhs, 0, &timeshift))
411+
return -EINVAL;
416412
ctx->timeshift = timeshift;
417413
break;
418414
}

0 commit comments

Comments
 (0)