提交 cb5f862e 编写于 作者: W wangchen

fix: M核代码告警清零

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

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

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

re #I4386N
Signed-off-by: Nwangchen <253227059@qq.com>
上级 3b37750f
......@@ -331,7 +331,7 @@ ssize_t read(int fd, void *buf, size_t nbyte)
errno = EINVAL;
return FS_FAILURE;
}
if (nbyte > 1024) {
if (nbyte > 1024) { /* 1024, max random_size */
nbyte = 1024; /* hks_generate_random: random_size must <= 1024 */
}
struct hks_blob key = {HKS_BLOB_TYPE_RAW, (uint8_t *)buf, nbyte};
......
......@@ -41,7 +41,7 @@ struct FileOpInfo g_fsOp[LOSCFG_LFS_MAX_MOUNT_SIZE] = {0};
static LittleFsHandleStruct g_handle[LITTLE_FS_MAX_OPEN_FILES] = {0};
struct dirent g_nameValue;
static pthread_mutex_t g_FslocalMutex = PTHREAD_MUTEX_INITIALIZER;
static const char *g_littlefsMntName[LOSCFG_LFS_MAX_MOUNT_SIZE] = {"/a","/b","/c"};
static const char *g_littlefsMntName[LOSCFG_LFS_MAX_MOUNT_SIZE] = {"/a", "/b", "/c"};
LittleFsHandleStruct *LfsAllocFd(const char *fileName, int *fd)
{
......
......@@ -242,7 +242,7 @@ static void getifaddrs_internal(struct getifaddrs_arg *arg)
if_storage = new_ifaddrs_storage();
if (if_storage == NULL) {
lwip_freeifaddrs(
*(arg->ifap)); /* ifap is assigned to NULL in getifaddrs, so garbage value will not be there */
*(arg->ifap)); /* ifap is assigned to NULL in getifaddrs, so garbage value will not be there */
arg->ret = ENOMEM;
goto RETURN;
}
......
......@@ -102,10 +102,10 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
if (buf_len < 1) {
goto out;
}
if(netif->link_layer_type == LOOPBACK_IF){
ret = snprintf_s(tmp, buf_len, (buf_len-1), "%s\t", netif->name);
if (netif->link_layer_type == LOOPBACK_IF) {
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "%s\t", netif->name);
} else {
ret = snprintf_s(tmp, buf_len, (buf_len-1), "%s%u\t", netif->name, netif->num);
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "%s%u\t", netif->name, netif->num);
}
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
......@@ -329,11 +329,11 @@ LWIP_STATIC int OsPingFunc(u32_t *parg)
u32_t iecho_len;
s16_t ip_hlen;
u32_t forever;
u32_t i = 0;
u32_t i;
u32_t succ_cnt = 0;
u32_t failed_cnt = 0;
struct timespec start, end;
long timout_ms = 0;
long timout_ms;
struct pollfd pfd;
long rtt;
int ret = 0;
......
......@@ -190,7 +190,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsCmdAscendingInsert(CmdItemNode *cmd)
}
for (cmdItem = LOS_DL_LIST_ENTRY((&cmdInfo.cmdList.list)->pstPrev, CmdItemNode, list);
&cmdItem->list != &(cmdInfo.cmdList.list);) {
&cmdItem->list != &(cmdInfo.cmdList.list); ) {
cmdNext = LOS_DL_LIST_ENTRY(cmdItem->list.pstPrev, CmdItemNode, list);
if (&cmdNext->list != &(cmdInfo.cmdList.list)) {
if ((strncmp(cmdItem->cmd->cmdKey, cmd->cmd->cmdKey, strlen(cmd->cmd->cmdKey)) >= 0) &&
......
......@@ -78,7 +78,7 @@ char *GetCmdName(const char *cmdline, unsigned int len)
/* Scan the 'cmdline' string for command */
/* Notice: Command string must not have any special name */
for (tmpStr = cmdline, loop = 0; (*tmpStr != '\0') && (loop < len);) {
for (tmpStr = cmdline, loop = 0; (*tmpStr != '\0') && (loop < len); ) {
/* If reach a double quotes, switch the quotes matching status */
if (*tmpStr == '\"') {
SWITCH_QUOTES_STATUS(quotes);
......@@ -114,12 +114,10 @@ int ShellCmdExec(const char *msgName, const char *cmdString)
}
uintRet = ShellMsgTypeGet(&cmdParsed, msgName);
if (uintRet != LOS_OK) {
PRINTK("%s:command not found\n", msgName);
return -EFAULT;
} else {
(void)OsCmdExec(&cmdParsed, (char *)cmdString);
}
return 0;
......
......@@ -88,11 +88,11 @@ static char *StrNormalizePath(char *fullpath)
while (*src != '\0') {
if (*src == '.') {
if (*(src + 1) == '/') {
src += 2;
src += 2; /* 2, sizeof "./" */
continue;
} else if (*(src + 1) == '.') {
if ((*(src + 2) == '/') || (*(src + 2) == '\0')) {
src += 2;
if ((*(src + 2) == '/') || (*(src + 2) == '\0')) { /* 2, 2, offset to check */
src += 2; /* 2, sizeof offset */
} else {
while ((*src != '\0') && (*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 */
if ((namelen > 1) && (filename[0] == '.') && (filename[1] == '/')) {
filename += 2;
filename += 2; /* 2, sizeof "./" */
}
fullpath = (char *)malloc(strlen(directory) + namelen + 2);
......@@ -184,8 +184,7 @@ static char *VfsNotAbsolutePath(const char *directory, const char *filename, cha
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,
"%s/%s", directory, filename);
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 */
fullpath = strdup(filename); /* copy string */
if (fullpath == NULL) {
*pathname = NULL;
SetErrno(ENOMEM);
......@@ -246,8 +244,7 @@ int VfsNormalizePath(const char *directory, const char *filename, char **pathnam
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)) {
return -ENAMETOOLONG;
}
......
......@@ -50,10 +50,10 @@ extern "C" {
* @version 1.0
*/
typedef enum {
/** The timer is not allowed to wake up the RTOS. */
osTimerRousesIgnore = 0,
/** The timer is allowed to wake up the RTOS. */
osTimerRousesAllow = 1
/** The timer is not allowed to wake up the RTOS. */
osTimerRousesIgnore = 0,
/** The timer is allowed to wake up the RTOS. */
osTimerRousesAllow = 1
} osTimerRouses_t;
/**
......@@ -61,10 +61,10 @@ typedef enum {
*
*/
typedef enum {
/** The timer ignores alignment. */
osTimerAlignIgnore = 0,
/** The timer allows alignment. */
osTimerAlignAllow = 1
/** The timer ignores alignment. */
osTimerAlignIgnore = 0,
/** The timer allows alignment. */
osTimerAlignAllow = 1
} osTimerAlign_t;
osTimerId_t osTimerExtNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr,
......
......@@ -63,5 +63,3 @@ extern VOID HalSecureContextSaveAsm(OsSecureContext *secureContext);
#endif /* __cplusplus */
#endif
......@@ -29,7 +29,6 @@
extern VOID HalHwiInit(VOID);
#define INITIAL_MSTATUS ( MSTATUS_MPP | MSTATUS_MPIE | MSTATUS_FS_INITIAL)
#define ALIGN_DOWN(size, align) ((size) & ~((align) - 1))
#ifdef __cplusplus
......
......@@ -71,13 +71,13 @@ LITE_OS_SEC_TEXT_INIT VOID HalHwiInit(VOID)
HWI_PROC_FUNC handler,
HWI_ARG_T arg)
{
if (hwiNum > SOC_INT_MAX){
if (hwiNum > SOC_INT_MAX) {
return OS_ERRNO_HWI_NUM_INVALID;
}
if (mode > ECLIC_VECTOR_INTERRUPT){
if (mode > ECLIC_VECTOR_INTERRUPT) {
return OS_ERRNO_HWI_MODE_INVALID;
}
if (arg > ECLIC_NEGTIVE_EDGE_TRIGGER){
if (arg > ECLIC_NEGTIVE_EDGE_TRIGGER) {
return OS_ERRNO_HWI_ARG_INVALID;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册