[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250527090007.1768305-1-suhui@nfschina.com>
Date: Tue, 27 May 2025 17:00:08 +0800
From: Su Hui <suhui@...china.com>
To: mikulas@...ax.karlin.mff.cuni.cz,
sandeen@...hat.com
Cc: Su Hui <suhui@...china.com>,
brauner@...nel.org,
linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH] 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@...china.com>
---
fs/hpfs/super.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 27567920abe4..8c594939ea80 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, ×hift))
+ return -EINVAL;
ctx->timeshift = timeshift;
break;
}
--
2.30.2
Powered by blists - more mailing lists