@@ -160,13 +160,13 @@ static const struct fs_parameter_description xfs_fs_parameters = {
};
STATIC int
-suffix_kstrtoint(const substring_t *s, unsigned int base, int *res)
+suffix_kstrtoint(const char *s, unsigned int base, int *res)
{
int last, shift_left_factor = 0, _res;
char *value;
int ret = 0;
- value = match_strdup(s);
+ value = kstrdup(s, GFP_KERNEL);
if (!value)
return -ENOMEM;
@@ -191,6 +191,20 @@ suffix_kstrtoint(const substring_t *s, unsigned int base, int *res)
return ret;
}
+STATIC int
+match_kstrtoint(const substring_t *s, unsigned int base, int *res)
+{
+ const char *value;
+ int ret;
+
+ value = match_strdup(s);
+ if (!value)
+ return -ENOMEM;
+ ret = suffix_kstrtoint(value, base, res);
+ kfree(value);
+ return ret;
+}
+
/*
* This function fills in xfs_mount_t fields based on mount args.
* Note: the superblock has _not_ yet been read in.
@@ -262,7 +276,7 @@ xfs_parseargs(
return -EINVAL;
break;
case Opt_logbsize:
- if (suffix_kstrtoint(args, 10, &mp->m_logbsize))
+ if (match_kstrtoint(args, 10, &mp->m_logbsize))
return -EINVAL;
break;
case Opt_logdev:
@@ -278,7 +292,7 @@ xfs_parseargs(
return -ENOMEM;
break;
case Opt_allocsize:
- if (suffix_kstrtoint(args, 10, &iosize))
+ if (match_kstrtoint(args, 10, &iosize))
return -EINVAL;
iosizelog = ffs(iosize) - 1;
break;