Skip to content

Commit da99d45

Browse files
Eric Sandeenbrauner
authored andcommitted
vboxsf: Convert to new uid/gid option parsing helpers
Convert to new uid/gid option parsing helpers From: Eric Sandeen <[email protected]> Signed-off-by: Eric Sandeen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent b548291 commit da99d45

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

fs/vboxsf/super.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ enum { opt_nls, opt_uid, opt_gid, opt_ttl, opt_dmode, opt_fmode,
4141

4242
static const struct fs_parameter_spec vboxsf_fs_parameters[] = {
4343
fsparam_string ("nls", opt_nls),
44-
fsparam_u32 ("uid", opt_uid),
45-
fsparam_u32 ("gid", opt_gid),
44+
fsparam_uid ("uid", opt_uid),
45+
fsparam_gid ("gid", opt_gid),
4646
fsparam_u32 ("ttl", opt_ttl),
4747
fsparam_u32oct ("dmode", opt_dmode),
4848
fsparam_u32oct ("fmode", opt_fmode),
@@ -55,8 +55,6 @@ static int vboxsf_parse_param(struct fs_context *fc, struct fs_parameter *param)
5555
{
5656
struct vboxsf_fs_context *ctx = fc->fs_private;
5757
struct fs_parse_result result;
58-
kuid_t uid;
59-
kgid_t gid;
6058
int opt;
6159

6260
opt = fs_parse(fc, vboxsf_fs_parameters, param, &result);
@@ -73,16 +71,10 @@ static int vboxsf_parse_param(struct fs_context *fc, struct fs_parameter *param)
7371
param->string = NULL;
7472
break;
7573
case opt_uid:
76-
uid = make_kuid(current_user_ns(), result.uint_32);
77-
if (!uid_valid(uid))
78-
return -EINVAL;
79-
ctx->o.uid = uid;
74+
ctx->o.uid = result.uid;
8075
break;
8176
case opt_gid:
82-
gid = make_kgid(current_user_ns(), result.uint_32);
83-
if (!gid_valid(gid))
84-
return -EINVAL;
85-
ctx->o.gid = gid;
77+
ctx->o.gid = result.gid;
8678
break;
8779
case opt_ttl:
8880
ctx->o.ttl = msecs_to_jiffies(result.uint_32);

0 commit comments

Comments
 (0)