efivarfs: Convert to new uid/gid option parsing helpers

Convert to new uid/gid option parsing helpers

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Link: https://lore.kernel.org/r/ff7c415c-43d4-4a1e-a987-246c781f8850@redhat.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Eric Sandeen 2024-06-27 19:30:56 -05:00 committed by Christian Brauner
parent 49abee5991
commit dcffad38c7
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -275,8 +275,8 @@ enum {
}; };
static const struct fs_parameter_spec efivarfs_parameters[] = { static const struct fs_parameter_spec efivarfs_parameters[] = {
fsparam_u32("uid", Opt_uid), fsparam_uid("uid", Opt_uid),
fsparam_u32("gid", Opt_gid), fsparam_gid("gid", Opt_gid),
{}, {},
}; };
@ -293,14 +293,10 @@ static int efivarfs_parse_param(struct fs_context *fc, struct fs_parameter *para
switch (opt) { switch (opt) {
case Opt_uid: case Opt_uid:
opts->uid = make_kuid(current_user_ns(), result.uint_32); opts->uid = result.uid;
if (!uid_valid(opts->uid))
return -EINVAL;
break; break;
case Opt_gid: case Opt_gid:
opts->gid = make_kgid(current_user_ns(), result.uint_32); opts->gid = result.gid;
if (!gid_valid(opts->gid))
return -EINVAL;
break; break;
default: default:
return -EINVAL; return -EINVAL;