fix: M核代码告警清零

【背景】定期M核代码告警清零。

【修改方案】
根据工具扫描结果,对代码告警进行更改。

【影响】
对现有的产品编译不会有影响。

re #I4386N
Signed-off-by: wangchen <253227059@qq.com>
This commit is contained in:
wangchen 2021-07-30 18:34:08 +08:00
parent 3b37750f37
commit cb5f862eaf
11 changed files with 27 additions and 35 deletions

View File

@ -331,7 +331,7 @@ ssize_t read(int fd, void *buf, size_t nbyte)
errno = EINVAL; errno = EINVAL;
return FS_FAILURE; return FS_FAILURE;
} }
if (nbyte > 1024) { if (nbyte > 1024) { /* 1024, max random_size */
nbyte = 1024; /* hks_generate_random: random_size must <= 1024 */ nbyte = 1024; /* hks_generate_random: random_size must <= 1024 */
} }
struct hks_blob key = {HKS_BLOB_TYPE_RAW, (uint8_t *)buf, nbyte}; struct hks_blob key = {HKS_BLOB_TYPE_RAW, (uint8_t *)buf, nbyte};

View File

@ -329,11 +329,11 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
u32_t iecho_len; u32_t iecho_len;
s16_t ip_hlen; s16_t ip_hlen;
u32_t forever; u32_t forever;
u32_t i = 0; u32_t i;
u32_t succ_cnt = 0; u32_t succ_cnt = 0;
u32_t failed_cnt = 0; u32_t failed_cnt = 0;
struct timespec start, end; struct timespec start, end;
long timout_ms = 0; long timout_ms;
struct pollfd pfd; struct pollfd pfd;
long rtt; long rtt;
int ret = 0; int ret = 0;

View File

@ -114,12 +114,10 @@ int ShellCmdExec(const char *msgName, const char *cmdString)
} }
uintRet = ShellMsgTypeGet(&cmdParsed, msgName); uintRet = ShellMsgTypeGet(&cmdParsed, msgName);
if (uintRet != LOS_OK) { if (uintRet != LOS_OK) {
PRINTK("%s:command not found\n", msgName); PRINTK("%s:command not found\n", msgName);
return -EFAULT; return -EFAULT;
} else { } else {
(void)OsCmdExec(&cmdParsed, (char *)cmdString); (void)OsCmdExec(&cmdParsed, (char *)cmdString);
} }
return 0; return 0;

View File

@ -88,11 +88,11 @@ static char *StrNormalizePath(char *fullpath)
while (*src != '\0') { while (*src != '\0') {
if (*src == '.') { if (*src == '.') {
if (*(src + 1) == '/') { if (*(src + 1) == '/') {
src += 2; src += 2; /* 2, sizeof "./" */
continue; continue;
} else if (*(src + 1) == '.') { } else if (*(src + 1) == '.') {
if ((*(src + 2) == '/') || (*(src + 2) == '\0')) { if ((*(src + 2) == '/') || (*(src + 2) == '\0')) { /* 2, 2, offset to check */
src += 2; src += 2; /* 2, sizeof offset */
} else { } else {
while ((*src != '\0') && (*src != '/')) { while ((*src != '\0') && (*src != '/')) {
*dest++ = *src++; *dest++ = *src++;
@ -174,7 +174,7 @@ static char *VfsNotAbsolutePath(const char *directory, const char *filename, cha
/* 2: The position of the path character: / and the end character /0 */ /* 2: The position of the path character: / and the end character /0 */
if ((namelen > 1) && (filename[0] == '.') && (filename[1] == '/')) { if ((namelen > 1) && (filename[0] == '.') && (filename[1] == '/')) {
filename += 2; filename += 2; /* 2, sizeof "./" */
} }
fullpath = (char *)malloc(strlen(directory) + namelen + 2); fullpath = (char *)malloc(strlen(directory) + namelen + 2);
@ -184,8 +184,7 @@ static char *VfsNotAbsolutePath(const char *directory, const char *filename, cha
return (char *)NULL; return (char *)NULL;
} }
/* join path and file name */ /* 2, sizeof "./", join path and file name */
ret = snprintf_s(fullpath, strlen(directory) + namelen + 2, strlen(directory) + namelen + 1, ret = snprintf_s(fullpath, strlen(directory) + namelen + 2, strlen(directory) + namelen + 1,
"%s/%s", directory, filename); "%s/%s", directory, filename);
if (ret < 0) { if (ret < 0) {
@ -213,7 +212,6 @@ static char *VfsNormalizeFullpath(const char *directory, const char *filename, c
/* it's a absolute path, use it directly */ /* it's a absolute path, use it directly */
fullpath = strdup(filename); /* copy string */ fullpath = strdup(filename); /* copy string */
if (fullpath == NULL) { if (fullpath == NULL) {
*pathname = NULL; *pathname = NULL;
SetErrno(ENOMEM); SetErrno(ENOMEM);
@ -246,8 +244,7 @@ int VfsNormalizePath(const char *directory, const char *filename, char **pathnam
return -EINVAL; return -EINVAL;
} }
/* 2: The position of the path character: / and the end character /0 */ /* 2, The position of the path character: / and the end character /0 */
if ((filename[0] != '/') && (strlen(directory) + namelen + 2 > TEMP_PATH_MAX)) { if ((filename[0] != '/') && (strlen(directory) + namelen + 2 > TEMP_PATH_MAX)) {
return -ENAMETOOLONG; return -ENAMETOOLONG;
} }

View File

@ -63,5 +63,3 @@ extern VOID HalSecureContextSaveAsm(OsSecureContext *secureContext);
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif #endif

View File

@ -29,7 +29,6 @@
extern VOID HalHwiInit(VOID); extern VOID HalHwiInit(VOID);
#define INITIAL_MSTATUS ( MSTATUS_MPP | MSTATUS_MPIE | MSTATUS_FS_INITIAL) #define INITIAL_MSTATUS ( MSTATUS_MPP | MSTATUS_MPIE | MSTATUS_FS_INITIAL)
#define ALIGN_DOWN(size, align) ((size) & ~((align) - 1)) #define ALIGN_DOWN(size, align) ((size) & ~((align) - 1))
#ifdef __cplusplus #ifdef __cplusplus