aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/cpu/sgx/ioctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c
index c206aee80a04..90a5caf76939 100644
--- a/arch/x86/kernel/cpu/sgx/ioctl.c
+++ b/arch/x86/kernel/cpu/sgx/ioctl.c
@@ -428,7 +428,7 @@ static long sgx_ioc_enclave_add_pages(struct sgx_encl *encl, void __user *arg)
!IS_ALIGNED(add_arg.src, PAGE_SIZE))
return -EINVAL;
- if (add_arg.length & (PAGE_SIZE - 1))
+ if (!add_arg.length || add_arg.length & (PAGE_SIZE - 1))
return -EINVAL;
if (add_arg.offset + add_arg.length - PAGE_SIZE >= encl->size)