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/fs/vfs/vfs_fs.c b/components/fs/vfs/vfs_fs.c index fd4e78f6..ce05503e 100644 --- a/components/fs/vfs/vfs_fs.c +++ b/components/fs/vfs/vfs_fs.c @@ -910,7 +910,7 @@ int LOS_Open(const char *path, int flags, ...) { #ifdef LOSCFG_RANDOM_DEV unsigned flagMask = O_RDONLY | O_WRONLY | O_RDWR | O_APPEND | O_CREAT | O_LARGEFILE | O_TRUNC | O_EXCL | O_DIRECTORY; - if ((unsigned)flags & ~flagMask) { + if (((unsigned)flags & ~flagMask) || (path == NULL)) { errno = EINVAL; return LOS_NOK; } @@ -952,7 +952,7 @@ int LOS_Open(const char *path, int flags, ...) FREE_AND_SET_NULL(canonicalPath); #endif #if (LOSCFG_POSIX_PIPE_API == 1) - if ((path != NULL) && !strncmp(path, PIPE_DEV_PATH, strlen(PIPE_DEV_PATH))) { + if (!strncmp(path, PIPE_DEV_PATH, strlen(PIPE_DEV_PATH))) { return PipeOpen(path, flags, PIPE_DEV_FD); } #endif diff --git a/components/fs/vfs/vfs_mount.c b/components/fs/vfs/vfs_mount.c index bde918f6..9b09a188 100644 --- a/components/fs/vfs/vfs_mount.c +++ b/components/fs/vfs/vfs_mount.c @@ -171,7 +171,7 @@ int LOS_FsMount(const char *source, const char *target, ret = mp->mFs->fsMops->mount(mp, mountflags, data); if (ret != 0) { /* errno is set */ - PRINT_ERR("mount failed, source %s, target %s.\n", source, target); + PRINT_ERR("mount failed, target %s.\n", target); goto errout; } mp->mRefs = 0; 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);