Commit fd8a620f authored by Su Hui's avatar Su Hui Committed by Mikulas Patocka
Browse files

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: default avatarSu Hui <suhui@nfschina.com>
Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
parent 68a74490
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -404,14 +404,10 @@ 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)
			if (kstrtoint(rhs, 0, &timeshift))
				return -EINVAL;
			ctx->timeshift = timeshift;
			break;