From ecdd47f0c5dfec4b205619b58a55aaa6b50f3684 Mon Sep 17 00:00:00 2001 From: liuwenxin Date: Tue, 7 Mar 2023 15:05:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BD=BF=E7=94=A8vprintf=E6=9D=A5=E6=89=93?= =?UTF-8?q?=E5=8D=B0va=5Flist=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuwenxin --- kernel/src/los_init.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/src/los_init.c b/kernel/src/los_init.c index e5ed4b32..eba1a3c8 100644 --- a/kernel/src/los_init.c +++ b/kernel/src/los_init.c @@ -37,6 +37,7 @@ #include "los_mux.h" #include "los_queue.h" #include "los_sem.h" +#include "securec.h" #if (LOSCFG_PLATFORM_HWI == 1) #include "los_interrupt.h" @@ -95,6 +96,8 @@ #include "los_trace_pri.h" #endif +#define BUFSIZE 256 + /***************************************************************************** Function : LOS_Reboot Description : system exception, die in here, wait for watchdog. @@ -110,10 +113,14 @@ LITE_OS_SEC_TEXT_INIT VOID LOS_Reboot(VOID) LITE_OS_SEC_TEXT_INIT VOID LOS_Panic(const CHAR *fmt, ...) { + char buf[BUFSIZE] = { 0 }; va_list ap; va_start(ap, fmt); - PRINT_ERR(fmt, ap); + int len = vsnprintf_s(buf, sizeof(buf), BUFSIZE - 1, fmt, ap); va_end(ap); + if (len > 0) { + PRINT_ERR("%s\n", buf); + } OsDoExcHook(EXC_PANIC); #if (LOSCFG_BACKTRACE_TYPE != 0) LOS_BackTrace();