The file pointer returned from fget() can be NULL, whereas a file's ops are guaranteed to be non-NULL. Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> --- arch/x86/kernel/cpu/sgx/driver/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/sgx/driver/ioctl.c b/arch/x86/kernel/cpu/sgx/driver/ioctl.c index f4a80585a519..89b3fb81c15b 100644 --- a/arch/x86/kernel/cpu/sgx/driver/ioctl.c +++ b/arch/x86/kernel/cpu/sgx/driver/ioctl.c @@ -801,7 +801,7 @@ static long sgx_ioc_enclave_set_attribute(struct file *filep, void __user *arg) return -EFAULT; attribute_file = fget(params.attribute_fd); - if (!attribute_file->f_op) + if (!attribute_file) return -EINVAL; if (attribute_file->f_op != &sgx_provision_fops) { -- 2.22.0