diff options
32 files changed, 101 insertions, 147 deletions
diff --git a/core/arch/arm32/kernel/sub.mk b/core/arch/arm32/kernel/sub.mk index 0147bdb7..8ada3d02 100644 --- a/core/arch/arm32/kernel/sub.mk +++ b/core/arch/arm32/kernel/sub.mk @@ -1,13 +1,5 @@ srcs-y += tee_core_trace.c -cflags-tee_core_trace.c-y += -Wno-format -cflags-tee_core_trace.c-y += -Wno-format-nonliteral -Wno-format-security - srcs-y += tee_ta_manager.c -cflags-tee_ta_manager.c-y += -Wno-declaration-after-statement -Wno-format -cflags-tee_ta_manager.c-y += -Wno-unused-parameter -cflags-tee_ta_manager.c-y += -Wno-format-nonliteral -Wno-format-security - - srcs-y += tee_sleep_services.c cflags-tee_sleep_services.c-y += -Wno-unused-parameter @@ -16,10 +8,8 @@ srcs-y += tee_time.c srcs-$(WITH_SECURE_TIME_SOURCE_CNTPCT) += tee_time_arm_cntpct.c srcs-$(WITH_SECURE_TIME_SOURCE_RTT) += tee_time_rtt.c srcs-$(WITH_SECURE_TIME_SOURCE_REE) += tee_time_ree.c -cflags-tee_time.c-y += -Wno-unused-parameter srcs-y += chip_services.c - srcs-y += tee_misc.c srcs-y += tee_time_unpg.c srcs-y += tz_proc.S diff --git a/core/arch/arm32/kernel/tee_core_trace.c b/core/arch/arm32/kernel/tee_core_trace.c index ff7ee8c0..15b57666 100644 --- a/core/arch/arm32/kernel/tee_core_trace.c +++ b/core/arch/arm32/kernel/tee_core_trace.c @@ -131,7 +131,7 @@ static int format_trace(const char *function, int line, int level, #endif nb_char = - snprintf(out, MAX_PRINT_SIZE, "%s [%p] %s:%s:%d: %s\n", + snprintf(out, MAX_PRINT_SIZE, "%s [0x%x] %s:%s:%d: %s\n", _trace_level_to_string[level], thread_id, prefix, func, line, in); } else { diff --git a/core/arch/arm32/kernel/tee_ta_manager.c b/core/arch/arm32/kernel/tee_ta_manager.c index b2fbf738..2cff14a1 100644 --- a/core/arch/arm32/kernel/tee_ta_manager.c +++ b/core/arch/arm32/kernel/tee_ta_manager.c @@ -123,7 +123,7 @@ static void jumper_invokecommand(void *voidargs) (uint32_t)args->cmd, (uint32_t)args->param->types, (TEE_Param *)args->param->params); - OUTMSG("%lx", args->res); + OUTMSG("%x", args->res); } static void jumper_opensession(void *voidargs) @@ -135,7 +135,7 @@ static void jumper_opensession(void *voidargs) (uint32_t)args->param->types, (TEE_Param *)args->param->params, (void **)&args->sess->user_ctx); - OUTMSG("%lx", args->res); + OUTMSG("%x", args->res); } static void jumper_createentrypoint(void *voidargs) @@ -144,7 +144,7 @@ static void jumper_createentrypoint(void *voidargs) INMSG(""); args->res = args->sess->ctx->static_ta->create_entry_point(); - OUTMSG("%lx", args->res); + OUTMSG("%x", args->res); } static void jumper_closesession(void *voidargs) @@ -155,7 +155,7 @@ static void jumper_closesession(void *voidargs) args->sess->ctx->static_ta->close_session_entry_point( (void *)args->sess->user_ctx); args->res = TEE_SUCCESS; - OUTMSG("%lx", args->res); + OUTMSG("%x", args->res); } static void jumper_destroyentrypoint(void *voidargs) @@ -165,7 +165,7 @@ static void jumper_destroyentrypoint(void *voidargs) INMSG(""); args->sess->ctx->static_ta->destroy_entry_point(); args->res = TEE_SUCCESS; - OUTMSG("%lx", args->res); + OUTMSG("%x", args->res); } /* Stack size is updated to take into account */ @@ -432,7 +432,8 @@ out: } static TEE_Result tee_ta_load_check_head_integrity( - kta_signed_header_t *signed_ta, ta_head_t *head) + kta_signed_header_t *signed_ta __unused, + ta_head_t *head __unused) { /* * This is where the signature of the signed header is verified @@ -1165,9 +1166,7 @@ static TEE_Result tee_ta_verify_param(struct tee_ta_session *sess, return TEE_SUCCESS; } -static TEE_Result tee_ta_init_session_with_context( - struct tee_ta_session_head *open_sessions, - struct tee_ta_ctx *ctx, +static TEE_Result tee_ta_init_session_with_context(struct tee_ta_ctx *ctx, struct tee_ta_session *s) { /* @@ -1186,7 +1185,7 @@ static TEE_Result tee_ta_init_session_with_context( if ((ctx->flags & TA_FLAG_MULTI_SESSION) == 0) return TEE_ERROR_BUSY; - DMSG(" ... Re-open TA %08lx-%04x-%04x", + DMSG(" ... Re-open TA %08x-%04x-%04x", ctx->head->uuid.timeLow, ctx->head->uuid.timeMid, ctx->head->uuid.timeHiAndVersion); @@ -1201,15 +1200,13 @@ static TEE_Result tee_ta_init_session_with_context( * Initialises a session based on the UUID or ptr to the ta * Returns ptr to the session (ta_session) and a TEE_Result *---------------------------------------------------------------------------*/ -static TEE_Result tee_ta_init_static_ta_session( - struct tee_ta_session_head *open_sessions, - const TEE_UUID *uuid, +static TEE_Result tee_ta_init_static_ta_session(const TEE_UUID *uuid, struct tee_ta_session *s) { struct tee_ta_ctx *ctx = NULL; ta_static_head_t *ta = NULL; - DMSG(" Lookup for Static TA %08lx-%04x-%04x", + DMSG(" Lookup for Static TA %08x-%04x-%04x", uuid->timeLow, uuid->timeMid, uuid->timeHiAndVersion); ta = &__start_ta_head_section; @@ -1239,7 +1236,7 @@ static TEE_Result tee_ta_init_static_ta_session( ctx->static_ta = ta; TAILQ_INSERT_TAIL(&tee_ctxes, ctx, link); - DMSG(" %s : %08lx-%04x-%04x", + DMSG(" %s : %08x-%04x-%04x", ctx->static_ta->name, ctx->head->uuid.timeLow, ctx->head->uuid.timeMid, @@ -1249,7 +1246,6 @@ static TEE_Result tee_ta_init_static_ta_session( } static TEE_Result tee_ta_init_session_with_signed_ta( - struct tee_ta_session_head *open_sessions, const kta_signed_header_t *signed_ta, struct tee_ta_session *s) { @@ -1261,7 +1257,7 @@ static TEE_Result tee_ta_init_session_with_signed_ta( if (res != TEE_SUCCESS) return res; - DMSG(" dyn TA : %08lx-%04x-%04x", + DMSG(" dyn TA : %08x-%04x-%04x", s->ctx->head->uuid.timeLow, s->ctx->head->uuid.timeMid, s->ctx->head->uuid.timeHiAndVersion); @@ -1292,13 +1288,13 @@ static TEE_Result tee_ta_init_session(TEE_ErrorOrigin *err, /* Look for already loaded TA */ ctx = tee_ta_context_find(uuid); if (ctx) { - res = tee_ta_init_session_with_context(open_sessions, ctx, s); + res = tee_ta_init_session_with_context(ctx, s); if (res == TEE_SUCCESS || res != TEE_ERROR_ITEM_NOT_FOUND) goto out; } /* Look for static TA */ - res = tee_ta_init_static_ta_session(open_sessions, uuid, s); + res = tee_ta_init_static_ta_session(uuid, s); if (res == TEE_SUCCESS || res != TEE_ERROR_ITEM_NOT_FOUND) goto out; @@ -1307,7 +1303,7 @@ static TEE_Result tee_ta_init_session(TEE_ErrorOrigin *err, if (res != TEE_SUCCESS) goto out; - res = tee_ta_init_session_with_signed_ta(open_sessions, ta, s); + res = tee_ta_init_session_with_signed_ta(ta, s); /* * Free normal world shared memory now that the TA either has been * copied into secure memory or the TA failed to be initialized. @@ -1343,7 +1339,7 @@ TEE_Result tee_ta_open_session(TEE_ErrorOrigin *err, res = tee_ta_init_session(err, open_sessions, uuid, &s); if (res != TEE_SUCCESS) { - EMSG("tee_ta_init_session() failed with error 0x%lx", res); + EMSG("tee_ta_init_session() failed with error 0x%x", res); return res; } @@ -1397,14 +1393,13 @@ TEE_Result tee_ta_open_session(TEE_ErrorOrigin *err, *err = TEE_ORIGIN_TRUSTED_APP; if (res != TEE_SUCCESS) - EMSG("Failed. Return error 0x%lx", res); + EMSG("Failed. Return error 0x%x", res); return res; } TEE_Result tee_ta_invoke_command(TEE_ErrorOrigin *err, struct tee_ta_session *sess, - const TEE_Identity *clnt_id, uint32_t cancel_req_to, uint32_t cmd, struct tee_ta_param *param) { @@ -1473,13 +1468,12 @@ TEE_Result tee_ta_invoke_command(TEE_ErrorOrigin *err, function_exit: sess->ctx->busy = false; if (res != TEE_SUCCESS) - EMSG(" => Error: %lx of %ld\n", res, *err); + EMSG(" => Error: %x of %d\n", res, *err); return res; } TEE_Result tee_ta_cancel_command(TEE_ErrorOrigin *err, - struct tee_ta_session *sess, - const TEE_Identity *clnt_id) + struct tee_ta_session *sess) { *err = TEE_ORIGIN_TEE; diff --git a/core/arch/arm32/mm/core_mmu.c b/core/arch/arm32/mm/core_mmu.c index 68a3ca66..78edaa6c 100644 --- a/core/arch/arm32/mm/core_mmu.c +++ b/core/arch/arm32/mm/core_mmu.c @@ -510,7 +510,8 @@ int core_tlb_maintenance(int op, unsigned int a) return 0; } -static unsigned int cache_maintenance_l1(int op, void *start, size_t len) +static unsigned int cache_maintenance_l1(int op, void *start __unused, + size_t len __unused) { switch (op) { case DCACHE_CLEAN: diff --git a/core/arch/arm32/mm/sub.mk b/core/arch/arm32/mm/sub.mk index 71f2dae0..1038600b 100644 --- a/core/arch/arm32/mm/sub.mk +++ b/core/arch/arm32/mm/sub.mk @@ -1,18 +1,8 @@ srcs-y += core_mmu.c -cflags-core_mmu.c-y += -Wno-strict-aliasing -Wno-unused-parameter - srcs-y += tee_pager_unpg.c -cflags-tee_pager_unpg.c-y += -Wno-unused-parameter - - srcs-y += tee_mmu.c -cflags-tee_mmu.c-y += -Wno-unused-parameter - srcs-y += kta_table_unpg_asm.S srcs-y += tee_mm.c -cflags-tee_mm.c-y += -Wno-format -cflags-tee_mm.c-y += -Wno-format-nonliteral -Wno-format-security - srcs-y += tee_mm_unpg.c srcs-y += tee_mmu_unpg_asm.S srcs-y += tee_mmu_unpg.c diff --git a/core/arch/arm32/mm/tee_mmu.c b/core/arch/arm32/mm/tee_mmu.c index c4d869d4..e10babc1 100644 --- a/core/arch/arm32/mm/tee_mmu.c +++ b/core/arch/arm32/mm/tee_mmu.c @@ -831,13 +831,13 @@ void teecore_init_pub_ram(void) default_nsec_shm_size = e - s; } -void *tee_mmu_ioremap(tee_paddr_t pa, size_t len) +void *tee_mmu_ioremap(tee_paddr_t pa __unused, size_t len __unused) { /* return (void *)ioremap((void *)pa, len); */ return (void *)NULL; } -void tee_mmu_iounmap(void *va) +void tee_mmu_iounmap(void *va __unused) { /* linux API */ /* iounmap(va); */ diff --git a/core/arch/arm32/mm/tee_pager_unpg.c b/core/arch/arm32/mm/tee_pager_unpg.c index 9c81efa4..35e3b5b8 100644 --- a/core/arch/arm32/mm/tee_pager_unpg.c +++ b/core/arch/arm32/mm/tee_pager_unpg.c @@ -76,9 +76,9 @@ bool tee_pager_is_abort_in_abort_handler(void) TEE_PAGER_SPSR_MODE_ABT; } -static void tee_pager_print_abort(const uint32_t addr, const uint32_t fsr, - const uint32_t pc, const uint32_t flags, - const uint32_t dbgpcsr) +static void tee_pager_print_abort(const uint32_t addr __unused, + const uint32_t fsr __unused, const uint32_t pc __unused, + const uint32_t flags __unused, const uint32_t dbgpcsr __unused) { DMSG("%s at 0x%x: FSR 0x%x PC 0x%x TTBR0 0x%X CONTEXIDR 0x%X", (flags == TEE_PAGER_DATA_ABORT) ? "data-abort" : @@ -88,9 +88,9 @@ static void tee_pager_print_abort(const uint32_t addr, const uint32_t fsr, TEE_PAGER_GET_CPUID_asm(), dbgpcsr, tee_pager_get_spsr()); } -static void tee_pager_print_error_abort(const uint32_t addr, const uint32_t fsr, - const uint32_t pc, const uint32_t flags, - const uint32_t dbgpcsr) +static void tee_pager_print_error_abort(const uint32_t addr __unused, + const uint32_t fsr __unused, const uint32_t pc __unused, + const uint32_t flags __unused, const uint32_t dbgpcsr __unused) { EMSG("%s at 0x%x\n" "FSR 0x%x PC 0x%x TTBR0 0x%X CONTEXIDR 0x%X\n" diff --git a/core/arch/arm32/plat-vexpress/sub.mk b/core/arch/arm32/plat-vexpress/sub.mk index 50c19642..006db3da 100644 --- a/core/arch/arm32/plat-vexpress/sub.mk +++ b/core/arch/arm32/plat-vexpress/sub.mk @@ -1,10 +1,7 @@ global-incdirs-y += . srcs-y += entry.S srcs-y += main.c - srcs-y += tee_common_otp.c -cflags-tee_common_otp.c-y += -Wno-unused-parameter - srcs-y += core_bootcfg.c srcs-y += core_chip.c srcs-y += rng_support.c diff --git a/core/arch/arm32/tee/sub.mk b/core/arch/arm32/tee/sub.mk index 0a620620..672849a3 100644 --- a/core/arch/arm32/tee/sub.mk +++ b/core/arch/arm32/tee/sub.mk @@ -1,7 +1,5 @@ srcs-y += arch_tee_fs.c srcs-y += tee_rpmb.c -cflags-tee_rpmb.c-y += -Wno-unused-parameter srcs-y += tee_svc_asm.S srcs-y += entry.c srcs-y += init.c -cflags-init.c-y += -Wno-unused-parameter diff --git a/core/arch/arm32/tee/tee_rpmb.c b/core/arch/arm32/tee/tee_rpmb.c index d5e4283c..4cafd66e 100644 --- a/core/arch/arm32/tee/tee_rpmb.c +++ b/core/arch/arm32/tee/tee_rpmb.c @@ -165,13 +165,14 @@ static struct tee_rpmb_ctx *rpmb_ctx; static TEE_Result mac_calc(uint8_t *mac, uint32_t macsize, uint8_t *data, uint32_t datasize, - uint8_t *key, uint32_t keylen) + uint8_t *key __unused, uint32_t keylen __unused) { return tee_hash_createdigest( TEE_ALG_HMAC_SHA256, data, datasize, mac, macsize); } -static TEE_Result mac_init(void *ctx, const uint8_t *key, uint32_t keysize) +static TEE_Result mac_init(void *ctx, const uint8_t *key __unused, + uint32_t keysize __unused) { return tee_hash_init(ctx, TEE_ALG_HMAC_SHA256); } @@ -212,7 +213,7 @@ static TEE_Result tee_get_hw_unique_key(struct tee_hw_unique_key *hwkey) return TEE_SUCCESS; } -static TEE_Result tee_rpmb_key_gen(uint16_t dev_id, +static TEE_Result tee_rpmb_key_gen(uint16_t dev_id __unused, uint8_t *key, uint32_t len, bool commercial) { TEE_Result res = TEE_ERROR_GENERIC; diff --git a/core/include/kernel/panic.h b/core/include/kernel/panic.h index 9ebc1212..63f07603 100644 --- a/core/include/kernel/panic.h +++ b/core/include/kernel/panic.h @@ -28,9 +28,10 @@ #ifndef KERNEL_PANIC_H #define KERNEL_PANIC_H +#include <compiler.h> + #define panic() __panic(__FILE__, __LINE__, __func__) -void __panic(const char *file, int line, const char *func) - __attribute__((noreturn)); +void __panic(const char *file, int line, const char *func) __noreturn; #endif /*KERNEL_PANIC_H*/ diff --git a/core/include/kernel/tee_core_trace.h b/core/include/kernel/tee_core_trace.h index 27c0b2ef..bd403002 100644 --- a/core/include/kernel/tee_core_trace.h +++ b/core/include/kernel/tee_core_trace.h @@ -46,7 +46,7 @@ extern int _trace_level; /* Trace api with trace formatting */ /* Filtering and call backend method */ -#define dprintf(level, ...) \ +#define dprintf_level(level, ...) \ do { \ if ((level) <= _trace_level) { \ _dprintf(__func__, __LINE__, \ @@ -66,28 +66,28 @@ extern int _trace_level; #if (CFG_TEE_CORE_LOG_LEVEL < TRACE_ERROR) #define EMSG(...) (void)0 #else -#define EMSG(...) dprintf(TRACE_ERROR, __VA_ARGS__) +#define EMSG(...) dprintf_level(TRACE_ERROR, __VA_ARGS__) #endif /* Formatted trace tagged with TRACE_INFO level */ #if (CFG_TEE_CORE_LOG_LEVEL < TRACE_INFO) #define IMSG(...) (void)0 #else -#define IMSG(...) dprintf(TRACE_INFO, __VA_ARGS__) +#define IMSG(...) dprintf_level(TRACE_INFO, __VA_ARGS__) #endif /* Formatted trace tagged with TRACE_DEBUG level */ #if (CFG_TEE_CORE_LOG_LEVEL < TRACE_DEBUG) #define DMSG(...) (void)0 #else -#define DMSG(...) dprintf(TRACE_DEBUG, __VA_ARGS__) +#define DMSG(...) dprintf_level(TRACE_DEBUG, __VA_ARGS__) #endif /* Formatted trace tagged with TRACE_FLOW level */ #if (CFG_TEE_CORE_LOG_LEVEL < TRACE_FLOW) #define FMSG(...) (void)0 #else -#define FMSG(...) dprintf(TRACE_FLOW, __VA_ARGS__) +#define FMSG(...) dprintf_level(TRACE_FLOW, __VA_ARGS__) #endif /* Formatted trace tagged with TRACE_FLOW level and prefix with '> ' */ @@ -98,7 +98,7 @@ extern int _trace_level; * an error message if r != 0 */ #define OUTRMSG(r) \ do { \ - OUTMSG("r=[%lx]", r); \ + OUTMSG("r=[%x]", r); \ return r; \ } while (0) diff --git a/core/include/kernel/tee_ta_manager.h b/core/include/kernel/tee_ta_manager.h index 94bc3728..a556adde 100644 --- a/core/include/kernel/tee_ta_manager.h +++ b/core/include/kernel/tee_ta_manager.h @@ -69,13 +69,11 @@ TEE_Result tee_ta_open_session(TEE_ErrorOrigin *err, TEE_Result tee_ta_invoke_command(TEE_ErrorOrigin *err, struct tee_ta_session *sess, - const TEE_Identity *clnt_id, uint32_t cancel_req_to, uint32_t cmd, struct tee_ta_param *param); TEE_Result tee_ta_cancel_command(TEE_ErrorOrigin *err, - struct tee_ta_session *sess, - const TEE_Identity *clnt_id); + struct tee_ta_session *sess); /*----------------------------------------------------------------------------- * Function called to close a TA. diff --git a/core/kernel/assert.c b/core/kernel/assert.c index 5a881755..e3474dc1 100644 --- a/core/kernel/assert.c +++ b/core/kernel/assert.c @@ -37,7 +37,7 @@ void _assert_log(const char *expr, const char *file, int line) EMSG("Assertion '%s' failed at %s:%d", expr, file, line); } -void __attribute__ ((noreturn)) _assert_break(void) +void _assert_break(void) { while (1) ; diff --git a/core/kernel/panic.c b/core/kernel/panic.c index fde15e3f..3a38b592 100644 --- a/core/kernel/panic.c +++ b/core/kernel/panic.c @@ -28,7 +28,8 @@ #include <kernel/panic.h> #include <kernel/tee_core_trace.h> -void __panic(const char *file, int line, const char *func) +void __panic(const char *file __unused, int line __unused, + const char *func __unused) { EMSG("PANIC: %s %s:%d\n", func, file, line); while (1) diff --git a/core/kernel/sub.mk b/core/kernel/sub.mk index b9e09143..d27b7a8a 100644 --- a/core/kernel/sub.mk +++ b/core/kernel/sub.mk @@ -1,5 +1,4 @@ srcs-y += assert.c -cflags-assert.c-y += -Wno-missing-prototypes -Wno-missing-declarations srcs-y += tee_compat.c srcs-y += tee_dispatch.c srcs-y += tee_kta_trace.c diff --git a/core/kernel/tee_dispatch.c b/core/kernel/tee_dispatch.c index 10147e53..ea425055 100644 --- a/core/kernel/tee_dispatch.c +++ b/core/kernel/tee_dispatch.c @@ -152,7 +152,7 @@ TEE_Result tee_dispatch_invoke_command(struct tee_dispatch_invoke_command_in * memcpy(out->params, in->params, sizeof(in->params)); memcpy(param.param_attr, in->param_attr, sizeof(in->param_attr)); - res = tee_ta_invoke_command(&err, sess, NULL, + res = tee_ta_invoke_command(&err, sess, TEE_TIMEOUT_INFINITE, in->cmd, ¶m); update_out_param(¶m, out->params); @@ -175,7 +175,7 @@ TEE_Result tee_dispatch_cancel_command(struct tee_dispatch_cancel_command_in * if (res != TEE_SUCCESS) goto cleanup_return; - res = tee_ta_cancel_command(&res_orig, sess, NULL); + res = tee_ta_cancel_command(&res_orig, sess); cleanup_return: out->msg.err = res_orig; diff --git a/core/tee/sub.mk b/core/tee/sub.mk index 5b5be336..ca7559c7 100644 --- a/core/tee/sub.mk +++ b/core/tee/sub.mk @@ -1,13 +1,5 @@ srcs-y += tee_svc.c -cflags-tee_svc.c-y += -Wno-format -Wno-declaration-after-statement -cflags-tee_svc.c-y += -Wno-unused-parameter -cflags-tee_svc.c-y += -Wno-format-nonliteral -Wno-format-security - srcs-y += tee_svc_cryp.c -cflags-tee_svc_cryp.c-y += -Wno-declaration-after-statement -cflags-tee_svc_cryp.c-y += -Wno-unused-parameter -cflags-tee_svc_cryp.c-y += -Wno-cast-align - srcs-y += tee_acipher.c cflags-tee_acipher.c-y += -Wno-unused-parameter diff --git a/core/tee/tee_svc.c b/core/tee/tee_svc.c index 62267c02..0dcf9045 100644 --- a/core/tee/tee_svc.c +++ b/core/tee/tee_svc.c @@ -69,18 +69,19 @@ void tee_svc_sys_panic(uint32_t code) struct tee_ta_session *sess; if (tee_ta_get_current_session(&sess) == TEE_SUCCESS) { - EMSG("Set session 0x%x to panicked", sess); + EMSG("Set session %p to panicked", (void *)sess); sess->ctx->panicked = 1; sess->ctx->panic_code = code; { + int *p = 0; + /* * Force panicking. This memory error will be trapped by * the error exception handler myErrorHandler() */ EMSG("Following 'DTLB exception in bundle'"); EMSG(" is generated with code %d", code); - int *p = 0; *p = 1; } } else { @@ -88,15 +89,16 @@ void tee_svc_sys_panic(uint32_t code) } } -uint32_t tee_svc_sys_dummy(uint32_t *a) +uint32_t tee_svc_sys_dummy(uint32_t *a __unused) { DMSG("tee_svc_sys_dummy: a 0x%x", (unsigned int)a); return 0; } -uint32_t tee_svc_sys_dummy_7args(uint32_t a1, uint32_t a2, uint32_t a3, - uint32_t a4, uint32_t a5, uint32_t a6, - uint32_t a7) +uint32_t tee_svc_sys_dummy_7args(uint32_t a1 __unused, uint32_t a2 __unused, + uint32_t a3 __unused, uint32_t a4 __unused, + uint32_t a5 __unused, uint32_t a6 __unused, + uint32_t a7 __unused) { DMSG("tee_svc_sys_dummy_7args: 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, %x, %x\n", a1, a2, a3, a4, a5, a6, a7); @@ -563,7 +565,6 @@ TEE_Result tee_svc_invoke_ta_command(TEE_TASessionHandle ta_sess, TEE_Result res; uint32_t ret_o = TEE_ORIGIN_TEE; struct tee_ta_param param = { 0 }; - TEE_Identity clnt_id; struct tee_ta_session *sess; struct tee_ta_session *called_sess = (struct tee_ta_session *)ta_sess; tee_mm_entry_t *mm_param = NULL; @@ -585,7 +586,7 @@ TEE_Result tee_svc_invoke_ta_command(TEE_TASessionHandle ta_sess, goto function_exit; res = - tee_ta_invoke_command(&ret_o, called_sess, &clnt_id, cancel_req_to, + tee_ta_invoke_command(&ret_o, called_sess, cancel_req_to, cmd_id, ¶m); if (res != TEE_SUCCESS) goto function_exit; diff --git a/core/tee/tee_svc_cryp.c b/core/tee/tee_svc_cryp.c index d2531b43..b7bc622f 100644 --- a/core/tee/tee_svc_cryp.c +++ b/core/tee/tee_svc_cryp.c @@ -1312,7 +1312,8 @@ static TEE_Result tee_svc_obj_generate_key_dsa( static TEE_Result tee_svc_obj_generate_key_dh( struct tee_ta_session *sess, struct tee_obj *o, const struct tee_cryp_obj_type_props *type_props, - uint32_t key_size, const TEE_Attribute *params, uint32_t param_count) + uint32_t key_size __unused, + const TEE_Attribute *params, uint32_t param_count) { TEE_Result res; struct tee_ltc_dh_key_pair *tee_dh_key; @@ -1728,7 +1729,8 @@ TEE_Result tee_svc_cryp_state_free(uint32_t state) } /* iv and iv_len are ignored for some algorithms */ -TEE_Result tee_svc_hash_init(uint32_t state, const void *iv, size_t iv_len) +TEE_Result tee_svc_hash_init(uint32_t state, const void *iv __unused, + size_t iv_len __unused) { TEE_Result res; struct tee_cryp_state *cs; diff --git a/lib/libutee/abort.c b/lib/libutee/abort.c index 4217722e..f8d2a29e 100644 --- a/lib/libutee/abort.c +++ b/lib/libutee/abort.c @@ -28,6 +28,12 @@ #include <stdio.h> #include <tee_api.h> +/* + * Not used directly from any source file, but required by some compiler + * library with some compiler options. + */ +void abort(void); + void abort(void) { printf("Abort!\n"); diff --git a/lib/libutee/arch/arm32/user_ta_entry.c b/lib/libutee/arch/arm32/user_ta_entry.c index b33b3373..beb7b89f 100644 --- a/lib/libutee/arch/arm32/user_ta_entry.c +++ b/lib/libutee/arch/arm32/user_ta_entry.c @@ -24,6 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include <compiler.h> #include <stdbool.h> #include <string.h> #include <sys/queue.h> @@ -40,18 +41,15 @@ extern const size_t ta_data_size; /* Exported to user_ta_header.c, built within TA */ -void ta_entry_close_session(uint32_t session_id) - /*__attribute__((noreturn))*/; +void ta_entry_close_session(uint32_t session_id) __noreturn; void ta_entry_open_session(uint32_t param_types, TEE_Param params[TEE_NUM_PARAMS], - uint32_t session_id) - /*__attribute__((noreturn))*/; + uint32_t session_id) __noreturn; void ta_entry_invoke_command(uint32_t cmd_id, uint32_t param_types, TEE_Param params[TEE_NUM_PARAMS], - uint32_t session_id) - /*__attribute__((noreturn))*/; + uint32_t session_id) __noreturn; /* * Some external allocation support from libutee or libutils. diff --git a/lib/libutee/include/tee_api.h b/lib/libutee/include/tee_api.h index bf69d2b3..f1d892a9 100644 --- a/lib/libutee/include/tee_api.h +++ b/lib/libutee/include/tee_api.h @@ -30,6 +30,7 @@ #define TEE_API_H #include <stddef.h> +#include <compiler.h> #include <tee_api_defines.h> #include <tee_api_types.h> @@ -71,11 +72,7 @@ TEE_Result TEE_GetNextProperty(TEE_PropSetHandle enumerator); /* System API - Misc */ -void TEE_Panic(TEE_Result panicCode) -#ifdef __GNUC__ -/* __attribute__((noreturn)) */ -#endif -; +void TEE_Panic(TEE_Result panicCode) __noreturn; /* System API - Internal Client API */ diff --git a/lib/libutee/include/tee_internal_api_extensions.h b/lib/libutee/include/tee_internal_api_extensions.h index d7a32afd..b147e904 100644 --- a/lib/libutee/include/tee_internal_api_extensions.h +++ b/lib/libutee/include/tee_internal_api_extensions.h @@ -30,8 +30,7 @@ /* trace support */ #include <tee_uta_trace.h> -int printf(const char *fmt, ...); -int puts(const char *str); +#include <stdio.h> /* * User mem module diff --git a/lib/libutee/include/tee_uta_trace.h b/lib/libutee/include/tee_uta_trace.h index 111110ec..3d5e0f58 100644 --- a/lib/libutee/include/tee_uta_trace.h +++ b/lib/libutee/include/tee_uta_trace.h @@ -46,7 +46,7 @@ int _dprintf_uta(const char *function, int line, int level, const char *prefix, /* Filtering and call backend method. * Retrieve the ta level strored at kernel side by a sys call */ -#define dprintf(level, ...) \ +#define dprintf_level(level, ...) \ do { \ if ((level) <= tahead_get_trace_level()) { \ _dprintf_uta(__func__, __LINE__, level, STR_TRACE_USER_TA, __VA_ARGS__); \ @@ -64,28 +64,28 @@ do { \ #if (CFG_TEE_TA_LOG_LEVEL < TRACE_ERROR) #define EMSG(...) (void)0 #else -#define EMSG(...) dprintf(TRACE_ERROR, __VA_ARGS__) +#define EMSG(...) dprintf_level(TRACE_ERROR, __VA_ARGS__) #endif /* Formmated trace tagged with TRACE_INFO level */ #if (CFG_TEE_TA_LOG_LEVEL < TRACE_INFO) #define IMSG(...) (void)0 #else -#define IMSG(...) dprintf(TRACE_INFO, __VA_ARGS__) +#define IMSG(...) dprintf_level(TRACE_INFO, __VA_ARGS__) #endif /* Formmated trace tagged with TRACE_DEBUG level */ #if (CFG_TEE_TA_LOG_LEVEL < TRACE_INFO) #define DMSG(...) (void)0 #else -#define DMSG(...) dprintf(TRACE_DEBUG, __VA_ARGS__) +#define DMSG(...) dprintf_level(TRACE_DEBUG, __VA_ARGS__) #endif /* Formmated trace tagged with TRACE_FLOW level */ #if (CFG_TEE_TA_LOG_LEVEL < TRACE_FLOW) #define FMSG(...) (void)0 #else -#define FMSG(...) dprintf(TRACE_FLOW, __VA_ARGS__) +#define FMSG(...) dprintf_level(TRACE_FLOW, __VA_ARGS__) #endif /* Formmated trace tagged with TRACE_FLOW level and prefix with '> ' */ diff --git a/lib/libutee/include/utee_syscalls.h b/lib/libutee/include/utee_syscalls.h index 50edea0b..eec514cd 100644 --- a/lib/libutee/include/utee_syscalls.h +++ b/lib/libutee/include/utee_syscalls.h @@ -27,6 +27,7 @@ #ifndef UTEE_SYSCALLS_H #define UTEE_SYSCALLS_H +#include <compiler.h> #include <stddef.h> #include <stdint.h> @@ -34,11 +35,11 @@ #include <tee_api_types.h> #include <tee_trace.h> -void utee_return(uint32_t ret) /*__attribute__((noreturn))*/ ; +void utee_return(uint32_t ret) __noreturn; void utee_log(const void *buf, size_t len); -void utee_panic(uint32_t code) /*__attribute__((noreturn))*/ ; +void utee_panic(uint32_t code) __noreturn; uint32_t utee_dummy(uint32_t *a); diff --git a/lib/libutee/sub.mk b/lib/libutee/sub.mk index 6d136437..5e33c844 100644 --- a/lib/libutee/sub.mk +++ b/lib/libutee/sub.mk @@ -1,21 +1,10 @@ global-incdirs-y += include srcs-y += tee_api_property.c -cflags-tee_api_property.c-y += -Wno-redundant-decls - srcs-y += tee_user_mem.c -cflags-remove-tee_user_mem.c-y += -Wdeclaration-after-statement - srcs-y += abort.c -cflags-abort.c-y += -Wno-missing-prototypes -Wno-missing-declarations -cflags-abort.c-y += -Wno-error - srcs-y += ta_trace.c -cflags-ta_trace.c-y += -Wno-redundant-decls - srcs-y += assert.c -cflags-assert.c-y += -Wno-missing-prototypes -Wno-missing-declarations - srcs-y += base64.c srcs-y += tee_api_arith.c srcs-y += tee_api.c diff --git a/lib/libutee/tee_user_mem.c b/lib/libutee/tee_user_mem.c index 924b7592..9845b774 100644 --- a/lib/libutee/tee_user_mem.c +++ b/lib/libutee/tee_user_mem.c @@ -292,10 +292,13 @@ static void heap_dec(size_t size) */ void *tee_user_mem_alloc(size_t len, uint32_t hint) { - INMSG("%d %p", (int)len, (void *)hint); - uint8_t *cp; void *buf = NULL; + size_t total_len = + len + sizeof(struct user_mem_elem) + CANARY_LINE_SIZE; + + + INMSG("%d %p", (int)len, (void *)hint); if ((int)len < 0) { OUTMSG("0x0"); @@ -307,9 +310,6 @@ void *tee_user_mem_alloc(size_t len, uint32_t hint) return (void *)ARTIST; } - size_t total_len = - len + sizeof(struct user_mem_elem) + CANARY_LINE_SIZE; - /* Check hint */ switch (hint) { case 0: @@ -420,6 +420,9 @@ void *tee_user_mem_realloc(void *buffer, size_t len) */ void tee_user_mem_free(void *buffer) { + uint8_t *cp; + struct user_mem_elem *e; + INMSG("[%p]", buffer); /* It is OK to free NULL */ @@ -432,9 +435,8 @@ void tee_user_mem_free(void *buffer) return; } - uint8_t *cp = elem_addr(buffer); - - struct user_mem_elem *e = (struct user_mem_elem *)(void *)cp; + cp = elem_addr(buffer); + e = (struct user_mem_elem *)(void *)cp; PB(TRACE_DEBUG, "Free: ", (void *)e); diff --git a/lib/libutils/isoc/include/assert.h b/lib/libutils/isoc/include/assert.h index 060ef2f7..4dadf946 100644 --- a/lib/libutils/isoc/include/assert.h +++ b/lib/libutils/isoc/include/assert.h @@ -27,7 +27,9 @@ #ifndef ASSERT_H #define ASSERT_H -void _assert_break(void); +#include <compiler.h> + +void _assert_break(void) __noreturn; void _assert_log(const char *expr, const char *file, int line); #define assert(expr) \ diff --git a/lib/libutils/isoc/newlib/sub.mk b/lib/libutils/isoc/newlib/sub.mk index 29a6660d..34462653 100644 --- a/lib/libutils/isoc/newlib/sub.mk +++ b/lib/libutils/isoc/newlib/sub.mk @@ -15,7 +15,6 @@ srcs-y += memset.c cflags-remove-memset.c-y += -Wcast-align cflags-memset.c-y += -Wno-sign-compare - srcs-y += strcmp.c cflags-remove-strcmp.c-y += -Wcast-align @@ -23,4 +22,3 @@ srcs-y += strlen.c cflags-remove-strlen.c-y += -Wcast-align srcs-y += strnlen.c - diff --git a/lib/libutils/isoc/sub.mk b/lib/libutils/isoc/sub.mk index a8b5ad10..54e359a5 100644 --- a/lib/libutils/isoc/sub.mk +++ b/lib/libutils/isoc/sub.mk @@ -1,6 +1,5 @@ global-incdirs-y += include - srcs-$(sm-core) += dlmalloc.c cflags-remove-dlmalloc.c-y += -Wcast-align -Wstrict-aliasing=2 diff --git a/ta/arch/arm32/user_ta_header.c b/ta/arch/arm32/user_ta_header.c index ce57de45..120b40f1 100644 --- a/ta/arch/arm32/user_ta_header.c +++ b/ta/arch/arm32/user_ta_header.c @@ -24,6 +24,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ +#include <compiler.h> #include <tee_ta_api.h> #include <tee_internal_api_extensions.h> #include <user_ta_header.h> @@ -35,18 +36,15 @@ #endif /* exprted to user_ta_header.c, built within TA */ -void ta_entry_close_session(uint32_t session_id) - /*__attribute__((noreturn))*/; +void ta_entry_close_session(uint32_t session_id) __noreturn; void ta_entry_open_session(uint32_t param_types, TEE_Param params[TEE_NUM_PARAMS], - uint32_t session_id) - /*__attribute__((noreturn))*/; + uint32_t session_id) __noreturn; void ta_entry_invoke_command(uint32_t cmd_id, uint32_t param_types, TEE_Param params[TEE_NUM_PARAMS], - uint32_t session_id) - /*__attribute__((noreturn))*/; + uint32_t session_id) __noreturn; /* These externs are defined in the ld link script */ extern uint32_t linker_RO_sections_size; |