x86/sgx: Create utility to validate user provided offset and length
authorReinette Chatre <reinette.chatre@intel.com>
Tue, 10 May 2022 18:08:46 +0000 (11:08 -0700)
committerDave Hansen <dave.hansen@linux.intel.com>
Thu, 7 Jul 2022 17:13:02 +0000 (10:13 -0700)
commitdda03e2c331b9fc7bbc8fc0de12a6d92d8c18661
treeea5e0d06bb8f8aa4327ad85279448153e9aa3c4e
parentc7c6a8a61b0066ba7e891783032dc2a7873c6dc7
x86/sgx: Create utility to validate user provided offset and length

User provided offset and length is validated when parsing the parameters
of the SGX_IOC_ENCLAVE_ADD_PAGES ioctl(). Extract this validation
(with consistent use of IS_ALIGNED) into a utility that can be used
by the SGX2 ioctl()s that will also provide these values.

Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lkml.kernel.org/r/767147bc100047abed47fe27c592901adfbb93a2.1652137848.git.reinette.chatre@intel.com
arch/x86/kernel/cpu/sgx/ioctl.c