[PATCH for_v22 02/11] x86/sgx: Fix incorrect NULL pointer check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux