aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs
diff options
context:
space:
mode:
authorSu Hui <suhui@nfschina.com>2025-05-27 17:00:08 +0800
committerMikulas Patocka <mpatocka@redhat.com>2025-09-08 17:23:34 +0200
commitfd8a620f195e7966d83c367def68818a2cc71177 (patch)
tree61e3d0cad1f209dba683887d4cf99c9f831b8a10 /fs/hpfs
parent68a74490629eb606ad77a88dd84515f35525e267 (diff)
downloadlinux-fd8a620f195e7966d83c367def68818a2cc71177.tar.gz
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>
Diffstat (limited to 'fs/hpfs')
-rw-r--r--fs/hpfs/super.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 42b779b4d87f87..8ab85e7ac91eb6 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -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;
}