regression 1010: fix build warning on zero-size TEE_Malloc() test
Fix build warning introduced in [1].
os_test.c:992:16: warning: variable ‘c’ set but not used [-Wunused-but-set-variable]
992 | volatile char c = 0;
| ^
Fixes: [1] commit e4c33f494189 ("regression 1010: test zero-size TEE_Malloc()")
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
diff --git a/ta/os_test/os_test.c b/ta/os_test/os_test.c
index d695c78..04128d3 100644
--- a/ta/os_test/os_test.c
+++ b/ta/os_test/os_test.c
@@ -989,7 +989,6 @@
long int stack_addr = (long int)&stack;
void (*volatile null_fn_ptr)(void) = NULL;
char *zero_size_malloc = NULL;
- volatile char c = 0;
if (param_types != TEE_PARAM_TYPES(TEE_PARAM_TYPE_VALUE_INPUT, 0, 0, 0) &&
param_types != TEE_PARAM_TYPES(TEE_PARAM_TYPE_VALUE_INPUT,
@@ -1016,7 +1015,8 @@
zero_size_malloc = TEE_Malloc(0, 0);
if (!zero_size_malloc)
return TEE_ERROR_GENERIC;
- c = *zero_size_malloc;
+ if (*zero_size_malloc)
+ return TEE_ERROR_GENERIC;
break;
case 7:
zero_size_malloc = TEE_Malloc(0, 0);