Skip to content

Commit e73d437

Browse files
author
Al Viro
committed
convert sgx_set_attribute() to fdget()/fdput()
Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 281117c commit e73d437

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

arch/x86/kernel/cpu/sgx/main.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -892,20 +892,19 @@ static struct miscdevice sgx_dev_provision = {
892892
int sgx_set_attribute(unsigned long *allowed_attributes,
893893
unsigned int attribute_fd)
894894
{
895-
struct file *file;
895+
struct fd f = fdget(attribute_fd);
896896

897-
file = fget(attribute_fd);
898-
if (!file)
897+
if (!f.file)
899898
return -EINVAL;
900899

901-
if (file->f_op != &sgx_provision_fops) {
902-
fput(file);
900+
if (f.file->f_op != &sgx_provision_fops) {
901+
fdput(f);
903902
return -EINVAL;
904903
}
905904

906905
*allowed_attributes |= SGX_ATTR_PROVISIONKEY;
907906

908-
fput(file);
907+
fdput(f);
909908
return 0;
910909
}
911910
EXPORT_SYMBOL_GPL(sgx_set_attribute);

0 commit comments

Comments
 (0)