1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-12 01:20:14 +00:00

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 <suhui@nfschina.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
This commit is contained in:
Su Hui 2025-05-27 17:00:08 +08:00 committed by Mikulas Patocka
parent 68a7449062
commit fd8a620f19

View File

@ -404,15 +404,11 @@ static int hpfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
break;
case Opt_timeshift:
{
int m = 1;
char *rhs = param->string;
int timeshift;
if (*rhs == '-') m = -1;
if (*rhs == '+' || *rhs == '-') rhs++;
timeshift = simple_strtoul(rhs, &rhs, 0) * m;
if (*rhs)
return -EINVAL;
if (kstrtoint(rhs, 0, &timeshift))
return -EINVAL;
ctx->timeshift = timeshift;
break;
}