diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2022-05-14 19:40:47 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2023-04-20 22:55:35 -0400 |
commit | e73d43760ad938428537dd6ccbb3653297a1bd69 (patch) | |
tree | 0a18b0ce0d2ab1995a60a84046cc3d2e664bec23 /arch/x86 | |
parent | 281117ccb2d2511d03f592dfec7ffdc33651e9b3 (diff) |
convert sgx_set_attribute() to fdget()/fdput()
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/cpu/sgx/main.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c index e5a37b6e9aa5..166692f2d501 100644 --- a/arch/x86/kernel/cpu/sgx/main.c +++ b/arch/x86/kernel/cpu/sgx/main.c @@ -892,20 +892,19 @@ static struct miscdevice sgx_dev_provision = { int sgx_set_attribute(unsigned long *allowed_attributes, unsigned int attribute_fd) { - struct file *file; + struct fd f = fdget(attribute_fd); - file = fget(attribute_fd); - if (!file) + if (!f.file) return -EINVAL; - if (file->f_op != &sgx_provision_fops) { - fput(file); + if (f.file->f_op != &sgx_provision_fops) { + fdput(f); return -EINVAL; } *allowed_attributes |= SGX_ATTR_PROVISIONKEY; - fput(file); + fdput(f); return 0; } EXPORT_SYMBOL_GPL(sgx_set_attribute); |