diff mbox series

[for_v23,11/16] selftests/x86/sgx: Sanitize the types for sgx_call()'s input params

Message ID 20191008044613.12350-12-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series x86/vdso: sgx: Major vDSO cleanup | expand

Commit Message

Sean Christopherson Oct. 8, 2019, 4:46 a.m. UTC
Declare the unused registers for sgx_call() a 'long' instead of 'void *'
and add a comment to explain that @rdi and @rsi are declared as 'void *'
only because they're always used to pass pointers.  Since the registers
are pass-through values, 'long' is the more intuitive declaration.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 tools/testing/selftests/x86/sgx/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/x86/sgx/main.c b/tools/testing/selftests/x86/sgx/main.c
index 5b7575a948ba..b7b32cf144f4 100644
--- a/tools/testing/selftests/x86/sgx/main.c
+++ b/tools/testing/selftests/x86/sgx/main.c
@@ -303,7 +303,8 @@  void load_sigstruct(const char *path, struct sgx_sigstruct *sigstruct)
 	close(fd);
 }
 
-int sgx_call(void *rdi, void *rsi, long rdx, void *rcx, void *r8, void *r9,
+/* Declare RDI and RSI as 'void *', they're always used to pass pointers. */
+int sgx_call(void *rdi, void *rsi, long rdx, long rcx, long r8, long r9,
 	     void *tcs, struct sgx_enclave_exception *ei, void *cb);
 
 int main(int argc, char *argv[], char *envp[])
@@ -336,8 +337,8 @@  int main(int argc, char *argv[], char *envp[])
 
 	encl_build(&secs, bin, bin_size, &sigstruct);
 
-	sgx_call((void *)&MAGIC, &result, 0, NULL, NULL, NULL,
-		 (void *)secs.base, &exception, NULL);
+	sgx_call((void *)&MAGIC, &result, 0, 0, 0, 0, (void *)secs.base,
+		 &exception, NULL);
 
 	ASSERT_EQ(result, MAGIC);