From 2d7bf3b7d8ea84961e802c366899aca891f38377 Mon Sep 17 00:00:00 2001 From: arvinzzz Date: Tue, 22 Mar 2022 18:21:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=91=8A=E8=AD=A6=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: arvinzzz Change-Id: I0535818b4c5f39c9ca916d2ff76eaffda900c726 --- components/exchook/los_exc_info.c | 5 +++-- components/shell/include/show.h | 2 +- components/shell/src/cmds/vfs_shellcmd.c | 2 +- .../SoC/demosoc/Common/Include/demosoc_i2c.h | 15 --------------- testsuites/sample/kernel/hwi/llt_los_hwi_035.c | 5 ----- testsuites/sample/kernel/lms/It_los_lms_023.c | 1 + .../sample/kernel/queue/It_los_queue_head_015.c | 2 -- testsuites/unittest/fuzz/src/socket/net_fuzz.c | 2 +- 8 files changed, 7 insertions(+), 27 deletions(-) diff --git a/components/exchook/los_exc_info.c b/components/exchook/los_exc_info.c index 334d852a..6dcd4973 100644 --- a/components/exchook/los_exc_info.c +++ b/components/exchook/los_exc_info.c @@ -92,6 +92,9 @@ STATIC UINT32 OsExcSaveIntStatus(UINT32 type, VOID *arg) /* save IRQ Priority reg group */ ret = memcpy_s(g_excContent, excContentEnd - (UINTPTR)g_excContent, (const VOID *)OS_NVIC_PRI_BASE, OS_NVIC_INT_PRI_SIZE); + if (ret != EOK) { + return LOS_NOK; + } g_excContent = (UINT8 *)g_excContent + OS_NVIC_INT_PRI_SIZE; /* save Exception Priority reg group */ @@ -294,5 +297,3 @@ VOID OsExcMsgDumpInit(VOID) (VOID)LOS_RegExcHook(EXC_INTERRUPT, (ExcHookFn)OsExcMsgDump); } #endif - - diff --git a/components/shell/include/show.h b/components/shell/include/show.h index 8520d369..61d9d78c 100644 --- a/components/shell/include/show.h +++ b/components/shell/include/show.h @@ -54,7 +54,7 @@ STATIC INLINE VOID SetErrno(INT32 errcode) STATIC INLINE VOID SetErr(INT32 errcode, const CHAR *errMessage) { SetErrno(errcode); - PRINTK(errMessage); + PRINTK("%s", errMessage); } #ifdef __cplusplus diff --git a/components/shell/src/cmds/vfs_shellcmd.c b/components/shell/src/cmds/vfs_shellcmd.c index 9210e3c5..6a478b71 100644 --- a/components/shell/src/cmds/vfs_shellcmd.c +++ b/components/shell/src/cmds/vfs_shellcmd.c @@ -130,7 +130,7 @@ STATIC CHAR *OsLsGetFullpath(const CHAR *path, struct dirent *pdirent) goto exit_with_nomem; } - ret = snprintf_s(fullpath, pathLen, pathLen, "%s/%s", path, pdirent->d_name); + ret = snprintf_s(fullpath, pathLen, pathLen - 1, "%s/%s", path, pdirent->d_name); if (ret < 0) { free(fullpath); return NULL; diff --git a/targets/riscv_nuclei_demo_soc_gcc/SoC/demosoc/Common/Include/demosoc_i2c.h b/targets/riscv_nuclei_demo_soc_gcc/SoC/demosoc/Common/Include/demosoc_i2c.h index 86428dbe..c3e887f0 100644 --- a/targets/riscv_nuclei_demo_soc_gcc/SoC/demosoc/Common/Include/demosoc_i2c.h +++ b/targets/riscv_nuclei_demo_soc_gcc/SoC/demosoc/Common/Include/demosoc_i2c.h @@ -34,21 +34,6 @@ extern "C" { #define I2C_SR_AL (1 << 5) #define I2C_SR_TIP (1 << 1)//0:transfer complete; 1:transferring #define I2C_SR_IF (1 << 0) -#if 0 -/*fileds*/ - -#define I2C_CTR_ENABLE 1 -#define I2C_CTR_DISABLE 0 - -#define I2C_CTR_INTEN 1 -#define I2C_CTR_INTDIS 0 - -#define I2C_TXR_RFS 1 //read from slave -#define I2C_TXR_WTS 0 //write to slave - -#define I2C - -#endif #ifdef __cplusplus } diff --git a/testsuites/sample/kernel/hwi/llt_los_hwi_035.c b/testsuites/sample/kernel/hwi/llt_los_hwi_035.c index 6da5a92c..3adfec9d 100644 --- a/testsuites/sample/kernel/hwi/llt_los_hwi_035.c +++ b/testsuites/sample/kernel/hwi/llt_los_hwi_035.c @@ -68,11 +68,6 @@ static UINT32 Testcase(VOID) ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret); return LOS_OK; - - LOS_TaskDelete(g_testTaskIdHwi); - TestHwiDelete(HWI_NUM_TEST); - - return LOS_OK; } /* ********** diff --git a/testsuites/sample/kernel/lms/It_los_lms_023.c b/testsuites/sample/kernel/lms/It_los_lms_023.c index 310ee2c5..71076cdd 100644 --- a/testsuites/sample/kernel/lms/It_los_lms_023.c +++ b/testsuites/sample/kernel/lms/It_los_lms_023.c @@ -54,6 +54,7 @@ static UINT32 TestCase(VOID) buf[7] = '\0'; /* end index 7 */ PRINTK("%d\n", __LINE__); ret = strcat_s(buf, 100, src); /* Check LMS detection information when the strcat dest max set 100 overflows. */ + ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret); PRINTK("%d\n", __LINE__); ret = LOS_MemFree(g_testLmsPool, buf); ICUNIT_ASSERT_NOT_EQUAL(ret, LOS_NOK, ret); diff --git a/testsuites/sample/kernel/queue/It_los_queue_head_015.c b/testsuites/sample/kernel/queue/It_los_queue_head_015.c index 1c6db5fe..262718bf 100644 --- a/testsuites/sample/kernel/queue/It_los_queue_head_015.c +++ b/testsuites/sample/kernel/queue/It_los_queue_head_015.c @@ -52,8 +52,6 @@ static UINT32 Testcase(VOID) ret = LOS_QueueRead(queueID[limit - 1], &buff2, QUEUE_BASE_MSGSIZE, 0); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); - ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &queueID[index], 0, QUEUE_BASE_MSGSIZE); - ret = LOS_QueueCreate("Q1", QUEUE_BASE_NUM, &queueID[index], 0, QUEUE_BASE_MSGSIZE); ICUNIT_GOTO_NOT_EQUAL(ret, LOS_OK, ret, EXIT); diff --git a/testsuites/unittest/fuzz/src/socket/net_fuzz.c b/testsuites/unittest/fuzz/src/socket/net_fuzz.c index 301e371b..76804964 100644 --- a/testsuites/unittest/fuzz/src/socket/net_fuzz.c +++ b/testsuites/unittest/fuzz/src/socket/net_fuzz.c @@ -226,7 +226,7 @@ static void *SampleTcpServer() sfd = accept(lsfd, (struct sockaddr *)&clnAddr, &num2); int num3 = *(int *)DT_SetGetS32(&g_element[NUM_2_INDEX], 0); - ret = recv(lsfd, buf, sizeof(buf), num3); + (void)recv(lsfd, buf, sizeof(buf), num3); int num4 = *(int *)DT_SetGetS32(&g_element[NUM_3_INDEX], 0); ret = shutdown(sfd, num4);