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

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

 



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@xxxxxxxxx>
---
 tools/testing/selftests/x86/sgx/main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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);
 
-- 
2.22.0




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

  Powered by Linux