diff mbox series

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

Message ID 20190808001254.11926-3-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series x86/sgx: Bug fixes for v22 | expand

Commit Message

Sean Christopherson Aug. 8, 2019, 12:12 a.m. UTC
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@intel.com>
---
 arch/x86/kernel/cpu/sgx/driver/ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jarkko Sakkinen Aug. 8, 2019, 3:36 p.m. UTC | #1
On Wed, Aug 07, 2019 at 05:12:45PM -0700, Sean Christopherson wrote:
> 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@intel.com>

Acked-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko
Jarkko Sakkinen Aug. 9, 2019, 9:16 p.m. UTC | #2
On Thu, Aug 08, 2019 at 06:36:43PM +0300, Jarkko Sakkinen wrote:
> On Wed, Aug 07, 2019 at 05:12:45PM -0700, Sean Christopherson wrote:
> > 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@intel.com>
> 
> Acked-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

2/11, 3/11 and 4/11 have been squashed and pushed.

/Jarkko
diff mbox series

Patch

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) {