Compare commits

..

2 Commits

Author SHA1 Message Date
openharmony_ci
bd864ea871 !939 refactor: sysroot部件化
Merge pull request !939 from Zhaotianyu/cherry-pick-1658840206
2022-07-26 15:40:34 +00:00
arvinzzz
e7c1633f00 fixed 1568c31 from https://gitee.com/arvinzzz/kernel_liteos_a/pulls/934
refactor: sysroot部件化
close: #I5HF8S

Signed-off-by: arvinzzz <zhaotianyu9@huawei.com>
Change-Id: I727b10c3b419fc71e228f5ad92abc107e756bbac
2022-07-26 12:56:47 +00:00
437 changed files with 2318 additions and 2682 deletions

View File

@@ -23,7 +23,6 @@
<licensefile></licensefile>
<policylist>
<policy name="projectPolicy" desc="">
<policyitem type="copyright" name="Huawei Technologies Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
<policyitem type="copyright" name="Huawei Device Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
</policy>

View File

@@ -180,8 +180,7 @@ static void LmsStrcpyTest(void)
return;
}
char *testStr = "bbbbbbbbbbbbbbbbb";
printf("[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d\n",
(int)strlen(testStr) + 1);
printf("[LmsStrcpyTest] strcpy overflow error should be triggered, src string buf size:%d\n", strlen(testStr) + 1);
strcpy(buf, testStr);
free(buf);
printf("\n-------- LmsStrcpyTest End --------\n");

View File

@@ -62,7 +62,7 @@ int main(int argc, char **argv)
PerfStop(fd);
} else if ((argc == THREE_ARGS) && strcmp(argv[1], "read") == 0) {
size_t size = strtoul(argv[THREE_ARGS - 1], NULL, 0);
if (size == 0) {
if (size <= 0) {
goto EXIT:
}

View File

@@ -1437,8 +1437,10 @@ u32_t lwip_tftp_get_file_by_filename_to_rawmem(u32_t ulHostAddr,
{
s32_t iSockNum = TFTP_NULL_INT32;
u32_t ulSrcStrLen;
u32_t lDestStrLen;
u32_t ulSize;
u32_t ulRecvSize = TFTP_NULL_UINT32;
s32_t iErrCode;
u32_t ulErrCode;
u16_t usReadReq;
u16_t usTempServPort;

View File

@@ -70,7 +70,7 @@ static void TraceRead(int fd, size_t size)
{
ssize_t i;
ssize_t len;
if (size == 0) {
if (size <= 0) {
return;
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -478,6 +478,7 @@ static int PthreadGetCputime(clockid_t clockID, struct timespec *ats)
uint64_t runtime;
UINT32 intSave;
UINT32 tid = GetTidFromClockID(clockID);
if (OS_TID_CHECK_INVALID(tid)) {
return -EINVAL;
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -42,7 +42,7 @@
#ifdef __cplusplus
#if __cplusplus
extern "C" {
extern "C"{
#endif
#endif /* __cplusplus */

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -343,8 +343,7 @@ static FRESULT init_cluster(DIR_FILE *pdfp, DIR *dp_new, FATFS *fs, int type, co
return FR_OK;
}
static int fatfs_create_obj(struct Vnode *parent, const char *name, int mode, struct Vnode **vpp,
BYTE type, const char *target)
static int fatfs_create_obj(struct Vnode *parent, const char *name, int mode, struct Vnode **vpp, BYTE type, const char *target)
{
struct Vnode *vp = NULL;
FATFS *fs = (FATFS *)parent->originMount->data;
@@ -1409,7 +1408,7 @@ DWORD fattime_format(time_t time)
ftime |= ((DWORD)((st.tm_year > YEAR_OFFSET) ? (st.tm_year - YEAR_OFFSET) : 0)) << FTIME_YEAR_OFFSET;
ftime <<= FTIME_DATE_OFFSET;
ftime |= (DWORD)st.tm_sec / SEC_MULTIPLIER;
ftime = (DWORD)st.tm_sec / SEC_MULTIPLIER;
ftime |= ((DWORD)st.tm_min) << FTIME_MIN_OFFSET;
ftime |= ((DWORD)st.tm_hour) << FTIME_HR_OFFSET;
@@ -2167,7 +2166,7 @@ int fatfs_symlink(struct Vnode *parentVnode, struct Vnode **newVnode, const char
ssize_t fatfs_readlink(struct Vnode *vnode, char *buffer, size_t bufLen)
{
int ret;
FRESULT res;
FRESULT res = FR_OK;
DWORD clust;
QWORD sect;
DIR_FILE *dfp = (DIR_FILE *)(vnode->data);

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -244,9 +244,8 @@ extern int chattr(const char *pathname, struct IATTR *attr);
*
* @retval #0 On success.
* @retval #-1 On failure with errno set.
* @retval CONTINE_NUTTX_FCNTL doesn't support some cmds in VfsFcntl, needs to continue going through
* Nuttx vfs operation.</li>
*
* @retval CONTINE_NUTTX_FCNTL doesn't support some cmds in VfsFcntl, needs to continue going through Nuttx vfs operation.</li>
*
* @par Dependency:
* <ul><li>fs.h</li></ul>
* @see None

View File

@@ -49,7 +49,7 @@ struct Mount {
LIST_HEAD vnodeList; /* list of vnodes */
int vnodeSize; /* size of vnode list */
LIST_HEAD activeVnodeList; /* list of active vnodes */
int activeVnodeSize; /* size of active vnodes list */
int activeVnodeSize; /* szie of active vnodes list */
void *data; /* private data */
uint32_t hashseed; /* Random seed for vfshash */
unsigned long mountFlags; /* Flags for mount */

View File

@@ -2311,7 +2311,7 @@ diff -Nupr old/fs/jffs2/erase.c new/fs/jffs2/erase.c
diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
--- old/fs/jffs2/file.c 2022-05-09 17:22:53.000000000 +0800
+++ new/fs/jffs2/file.c 2022-05-10 09:43:14.250000000 +0800
@@ -9,335 +9,30 @@
@@ -9,325 +9,34 @@
* For licensing information, see the file 'LICENCE' in this directory.
*
*/
@@ -2336,35 +2336,32 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- loff_t pos, unsigned len, unsigned flags,
- struct page **pagep, void **fsdata);
-static int jffs2_readpage (struct file *filp, struct page *pg);
-
-int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
-{
- struct inode *inode = filp->f_mapping->host;
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- int ret;
-
- ret = file_write_and_wait_range(filp, start, end);
- if (ret)
- return ret;
- inode_lock(inode);
- /* Trigger GC to flush any pending writes for this inode */
- jffs2_flush_wbuf_gc(c, inode->i_ino);
- inode_unlock(inode);
+static unsigned char gc_buffer[PAGE_SIZE]; //avoids malloc when user may be under memory pressure
-int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
- return 0;
-}
-const struct file_operations jffs2_file_operations =
+unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
+ struct jffs2_inode_info *f,
+ unsigned long offset,
+ unsigned long *priv)
{
- struct inode *inode = filp->f_mapping->host;
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
+ /* FIXME: This works only with one file system mounted at a time */
int ret;
-
- ret = file_write_and_wait_range(filp, start, end);
+ ret = jffs2_read_inode_range(c, f, gc_buffer,
+ offset & ~(PAGE_SIZE-1), PAGE_SIZE);
if (ret)
- return ret;
-
- inode_lock(inode);
- /* Trigger GC to flush any pending writes for this inode */
- jffs2_flush_wbuf_gc(c, inode->i_ino);
- inode_unlock(inode);
-
- return 0;
-}
-
-const struct file_operations jffs2_file_operations =
-{
- .llseek = generic_file_llseek,
- .open = generic_file_open,
- .read_iter = generic_file_read_iter,
@@ -2398,8 +2395,9 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- unsigned char *pg_buf;
- int ret;
-
+ /* FIXME: This works only with one file system mounted at a time */
int ret;
- jffs2_dbg(2, "%s(): ino #%lu, page at offset 0x%lx\n",
- __func__, inode->i_ino, pg->index << PAGE_SHIFT);
-
@@ -2438,15 +2436,18 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
-{
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(pg->mapping->host);
- int ret;
-
+ ret = jffs2_read_inode_range(c, f, gc_buffer,
+ offset & ~(PAGE_SIZE-1), PAGE_SIZE);
+ if (ret)
+ return ERR_PTR(ret);
- mutex_lock(&f->sem);
- ret = jffs2_do_readpage_unlock(pg->mapping->host, pg);
- mutex_unlock(&f->sem);
- return ret;
+ return ERR_PTR(ret);
+ return gc_buffer;
}
-
-static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
- loff_t pos, unsigned len, unsigned flags,
- struct page **pagep, void **fsdata)
@@ -2457,15 +2458,20 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- struct page *pg;
- struct inode *inode = mapping->host;
- struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- pgoff_t index = pos >> PAGE_SHIFT;
- uint32_t pageofs = index << PAGE_SHIFT;
- int ret = 0;
-
- pg = grab_cache_page_write_begin(mapping, index, flags);
- if (!pg)
- return -ENOMEM;
- *pagep = pg;
-
- jffs2_dbg(1, "%s()\n", __func__);
-
- if (pageofs > inode->i_size) {
- /* Make new hole frag from old EOF to new page */
- struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb);
- struct jffs2_raw_inode ri;
- struct jffs2_full_dnode *fn;
- uint32_t alloc_len;
@@ -2476,7 +2482,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- ret = jffs2_reserve_space(c, sizeof(ri), &alloc_len,
- ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE);
- if (ret)
- goto out_err;
- goto out_page;
-
- mutex_lock(&f->sem);
- memset(&ri, 0, sizeof(ri));
@@ -2506,7 +2512,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- ret = PTR_ERR(fn);
- jffs2_complete_reservation(c);
- mutex_unlock(&f->sem);
- goto out_err;
- goto out_page;
- }
- ret = jffs2_add_full_dnode_to_inode(c, f, fn);
- if (f->metadata) {
@@ -2521,7 +2527,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- jffs2_free_full_dnode(fn);
- jffs2_complete_reservation(c);
- mutex_unlock(&f->sem);
- goto out_err;
- goto out_page;
- }
- jffs2_complete_reservation(c);
- inode->i_size = pageofs;
@@ -2529,19 +2535,6 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- }
-
- /*
- * While getting a page and reading data in, lock c->alloc_sem until
- * the page is Uptodate. Otherwise GC task may attempt to read the same
- * page in read_cache_page(), which causes a deadlock.
- */
- mutex_lock(&c->alloc_sem);
- pg = grab_cache_page_write_begin(mapping, index, flags);
- if (!pg) {
- ret = -ENOMEM;
- goto release_sem;
- }
- *pagep = pg;
-
- /*
- * Read in the page if it wasn't already present. Cannot optimize away
- * the whole page write case until jffs2_write_end can handle the
- * case of a short-copy.
@@ -2550,20 +2543,19 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- mutex_lock(&f->sem);
- ret = jffs2_do_readpage_nolock(inode, pg);
- mutex_unlock(&f->sem);
- if (ret) {
- unlock_page(pg);
- put_page(pg);
- goto release_sem;
- }
- if (ret)
- goto out_page;
- }
- jffs2_dbg(1, "end write_begin(). pg->flags %lx\n", pg->flags);
-
-release_sem:
- mutex_unlock(&c->alloc_sem);
-out_err:
- return ret;
-}
-
-out_page:
- unlock_page(pg);
- put_page(pg);
- return ret;
+ /* Do nothing */
}
-static int jffs2_write_end(struct file *filp, struct address_space *mapping,
- loff_t pos, unsigned len, unsigned copied,
- struct page *pg, void *fsdata)
@@ -2661,8 +2653,7 @@ diff -Nupr old/fs/jffs2/file.c new/fs/jffs2/file.c
- unlock_page(pg);
- put_page(pg);
- return writtenlen > 0 ? writtenlen : ret;
+ /* Do nothing */
}
-}
diff -Nupr old/fs/jffs2/fs.c new/fs/jffs2/fs.c
--- old/fs/jffs2/fs.c 2022-05-09 17:22:53.000000000 +0800
+++ new/fs/jffs2/fs.c 2022-05-10 16:13:37.830000000 +0800

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -682,6 +682,7 @@ int VfsJffs2Rmdir(struct Vnode *parentVnode, struct Vnode *targetVnode, const ch
LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER);
ret = jffs2_rmdir(parentInode, targetInode, (const unsigned char *)path);
if (ret == 0) {
(void)jffs2_iput(targetInode);
}
@@ -808,6 +809,7 @@ int VfsJffs2Unlink(struct Vnode *parentVnode, struct Vnode *targetVnode, const c
LOS_MuxLock(&g_jffs2FsLock, (uint32_t)JFFS2_WAITING_FOREVER);
ret = jffs2_unlink(parentInode, targetInode, (const unsigned char *)path);
if (ret == 0) {
(void)jffs2_iput(targetInode);
}

View File

@@ -137,7 +137,7 @@ struct ProcData {
#define S_IALLUGO (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
/**
* Interface for modules using proc below internal proc module;
* Interface for modules using proc below internal proc moudule;
*/
/**
* @ingroup procfs

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -154,8 +154,7 @@ static int FsCacheInfoFill(struct SeqBuf *buf, void *arg)
VnodeHold();
LosBufPrintf(buf, "\n=================================================================\n");
LosBufPrintf(buf,
"VnodeAddr ParentAddr DataAddr VnodeOps Hash Ref Type Gid Uid Mode\n");
LosBufPrintf(buf, "VnodeAddr ParentAddr DataAddr VnodeOps Hash Ref Type Gid Uid Mode\n");
vnodeVirtual = VnodeListProcess(buf, GetVnodeVirtualList());
vnodeFree = VnodeListProcess(buf, GetVnodeFreeList());
vnodeActive = VnodeListProcess(buf, GetVnodeActiveList());

View File

@@ -62,9 +62,8 @@ static struct ProcDirEntry g_procRootDirEntry = {
int ProcMatch(unsigned int len, const char *name, struct ProcDirEntry *pn)
{
if (len != pn->nameLen) {
if (len != pn->nameLen)
return 0;
}
return !strncmp(name, pn->name, len);
}
@@ -388,9 +387,8 @@ static void FreeProcEntry(struct ProcDirEntry *entry)
void ProcFreeEntry(struct ProcDirEntry *pn)
{
if (atomic_dec_and_test(&pn->count)) {
if (atomic_dec_and_test(&pn->count))
FreeProcEntry(pn);
}
}
static void RemoveProcEntryTravalsal(struct ProcDirEntry *pn)

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -62,8 +62,8 @@ int OsShellCmdWriteProc(int argc, char **argv)
if (argc == WRITEPROC_ARGC) {
value = argv[0];
path = argv[2]; // 2: index of path
len = strlen(value) + 1; /* + 1:add the \0 */
path = argv[2];
len = strlen(value) + 1; /* +1:add the \0 */
if (strncmp(argv[1], ">>", strlen(">>")) == 0) {
if ((realpath(path, realPath) == NULL) || (strncmp(realPath, rootProcDir, strlen(rootProcDir)) != 0)) {
PRINT_ERR("No such file or directory\n");

View File

@@ -581,8 +581,8 @@ static OsBcacheBlock *AllocNewBlock(OsBcache *bc, BOOL read, UINT64 num)
DelBlock(bc, prefer);
}
if (prefer->used) { /* do not combine with next check */
MergeSyncBlocks(bc, prefer); /* prefer->used may be changed here */
if (prefer->used) {
MergeSyncBlocks(bc, prefer);
}
if (prefer->used) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -304,7 +304,7 @@ int epoll_wait(int epfd, FAR struct epoll_event *evs, int maxevents, int timeout
int pollSize;
epHead = EpollGetDataBuff(epfd);
if (epHead == NULL) {
if (epHead== NULL) {
set_errno(EBADF);
return -1;
}

View File

@@ -160,7 +160,7 @@ typedef int VfsHashCmp(struct Vnode *vnode, void *arg);
int VnodesInit(void);
int VnodeDevInit(void);
int VnodeAlloc(struct VnodeOps *vop, struct Vnode **newVnode);
int VnodeAlloc(struct VnodeOps *vop, struct Vnode **vnode);
int VnodeFree(struct Vnode *vnode);
int VnodeLookup(const char *path, struct Vnode **vnode, uint32_t flags);
int VnodeLookupFullpath(const char *fullpath, struct Vnode **vnode, uint32_t flags);

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -225,6 +225,7 @@ static char *vfs_normalize_fullpath(const char *directory, const char *filename,
/* it's a absolute path, use it directly */
fullpath = strdup(filename); /* copy string */
if (fullpath == NULL) {
*pathname = NULL;
set_errno(ENOMEM);
@@ -257,10 +258,11 @@ int vfs_normalize_path(const char *directory, const char *filename, char **pathn
}
#ifdef VFS_USING_WORKDIR
if (directory == NULL) {
if (directory == NULL)
{
spin_lock_irqsave(&curr->files->workdir_lock, lock_flags);
directory = curr->files->workdir;
}
}
#else
if ((directory == NULL) && (filename[0] != '/')) {
PRINT_ERR("NO_WORKING_DIR\n");
@@ -273,18 +275,20 @@ int vfs_normalize_path(const char *directory, const char *filename, char **pathn
if ((filename[0] != '/') && (strlen(directory) + namelen + 2 > TEMP_PATH_MAX)) {
#ifdef VFS_USING_WORKDIR
if (dir_flags == TRUE) {
if (dir_flags == TRUE)
{
spin_unlock_irqrestore(&curr->files->workdir_lock, lock_flags);
}
}
#endif
return -ENAMETOOLONG;
}
fullpath = vfs_normalize_fullpath(directory, filename, pathname, namelen);
#ifdef VFS_USING_WORKDIR
if (dir_flags == TRUE) {
if (dir_flags == TRUE)
{
spin_unlock_irqrestore(&curr->files->workdir_lock, lock_flags);
}
}
#endif
if (fullpath == NULL) {
return -get_errno();
@@ -304,7 +308,7 @@ int vfs_normalize_path(const char *directory, const char *filename, char **pathn
int vfs_normalize_pathat(int dirfd, const char *filename, char **pathname)
{
/* Get path by dirfd */
/* Get path by dirfd*/
char *relativeoldpath = NULL;
char *fullpath = NULL;
int ret = 0;

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -132,19 +132,19 @@ int VfsPermissionCheck(uint fuid, uint fgid, uint fileMode, int accMode)
#ifdef VFS_USING_WORKDIR
static int SetWorkDir(const char *dir, size_t len)
{
errno_t ret;
uint lock_flags;
LosProcessCB *curr = OsCurrProcessGet();
errno_t ret;
uint lock_flags;
LosProcessCB *curr = OsCurrProcessGet();
spin_lock_irqsave(&curr->files->workdir_lock, lock_flags);
ret = strncpy_s(curr->files->workdir, PATH_MAX, dir, len);
curr->files->workdir[PATH_MAX - 1] = '\0';
spin_unlock_irqrestore(&curr->files->workdir_lock, lock_flags);
if (ret != EOK) {
return -1;
}
spin_lock_irqsave(&curr->files->workdir_lock, lock_flags);
ret = strncpy_s(curr->files->workdir, PATH_MAX, dir, len);
curr->files->workdir[PATH_MAX - 1] = '\0';
spin_unlock_irqrestore(&curr->files->workdir_lock, lock_flags);
if (ret != EOK) {
return -1;
}
return 0;
return 0;
}
#endif
@@ -155,6 +155,7 @@ int chdir(const char *path)
char *fullpath_bak = NULL;
struct stat statBuff;
if (!path) {
set_errno(EFAULT);
return -1;

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -57,6 +57,7 @@ int utime(const char *path, const struct utimbuf *ptimes)
/* Sanity checks */
if (path == NULL) {
ret = -EINVAL;
goto errout;

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -239,7 +239,7 @@ BOOL VnodeInUseIter(const struct Mount *mount)
return FALSE;
}
int VnodeHold(void)
int VnodeHold()
{
int ret = LOS_MuxLock(&g_vnodeMux, LOS_WAIT_FOREVER);
if (ret != LOS_OK) {
@@ -248,7 +248,7 @@ int VnodeHold(void)
return ret;
}
int VnodeDrop(void)
int VnodeDrop()
{
int ret = LOS_MuxUnlock(&g_vnodeMux);
if (ret != LOS_OK) {
@@ -583,7 +583,7 @@ int VnodeCreate(struct Vnode *parent, const char *name, int mode, struct Vnode *
return 0;
}
int VnodeDevInit(void)
int VnodeDevInit()
{
struct Vnode *devNode = NULL;
struct Mount *devMount = NULL;
@@ -616,7 +616,7 @@ int VnodeGetattr(struct Vnode *vnode, struct stat *buf)
return LOS_OK;
}
struct Vnode *VnodeGetRoot(void)
struct Vnode *VnodeGetRoot()
{
return g_rootVnode;
}
@@ -697,7 +697,7 @@ LIST_HEAD* GetVnodeActiveList()
return &g_vnodeActiveList;
}
int VnodeClearCache(void)
int VnodeClearCache()
{
struct Vnode *item = NULL;
struct Vnode *nextItem = NULL;

View File

@@ -61,11 +61,11 @@ STATIC INLINE VOID OsSemDbgTimeUpdateHook(UINT32 semID)
return;
}
/* Update the SEM_DEBUG_CB of the semaphore when created or deleted */
extern VOID OsSemDbgUpdate(UINT32 semID, TSK_ENTRY_FUNC creator, UINT16 count);
STATIC INLINE VOID OsSemDbgUpdateHook(UINT32 semID, TSK_ENTRY_FUNC creator, UINT16 count)
extern VOID OsSemDbgUpdate(UINT32 semID, TSK_ENTRY_FUNC creater, UINT16 count);
STATIC INLINE VOID OsSemDbgUpdateHook(UINT32 semID, TSK_ENTRY_FUNC creater, UINT16 count)
{
#ifdef LOSCFG_DEBUG_SEMAPHORE
OsSemDbgUpdate(semID, creator, count);
OsSemDbgUpdate(semID, creater, count);
#endif
return;
}

View File

@@ -40,7 +40,7 @@
#ifdef LOSCFG_DEBUG_QUEUE
typedef struct {
TSK_ENTRY_FUNC creator; /* The task entry who created this queue */
TSK_ENTRY_FUNC creater; /* The task entry who created this queue */
UINT64 lastAccessTime; /* The last access time */
} QueueDebugCB;
STATIC QueueDebugCB *g_queueDebugArray = NULL;
@@ -74,7 +74,7 @@ VOID OsQueueDbgTimeUpdate(UINT32 queueID)
VOID OsQueueDbgUpdate(UINT32 queueID, TSK_ENTRY_FUNC entry)
{
QueueDebugCB *queueDebug = &g_queueDebugArray[GET_QUEUE_INDEX(queueID)];
queueDebug->creator = entry;
queueDebug->creater = entry;
queueDebug->lastAccessTime = LOS_TickCountGet();
return;
}
@@ -91,8 +91,8 @@ STATIC INLINE VOID OsQueueInfoOutPut(const LosQueueCB *node)
STATIC INLINE VOID OsQueueOpsOutput(const QueueDebugCB *node)
{
PRINTK("TaskEntry of creator:0x%p, Latest operation time: 0x%llx\n",
node->creator, node->lastAccessTime);
PRINTK("TaskEntry of creater:0x%p, Latest operation time: 0x%llx\n",
node->creater, node->lastAccessTime);
}
STATIC VOID SortQueueIndexArray(UINT32 *indexArray, UINT32 count)
@@ -149,7 +149,7 @@ VOID OsQueueCheck(VOID)
&g_queueDebugArray[index], sizeof(QueueDebugCB));
SCHEDULER_UNLOCK(intSave);
if ((queueNode.queueState == OS_QUEUE_UNUSED) ||
((queueNode.queueState == OS_QUEUE_INUSED) && (queueDebugNode.creator == NULL))) {
((queueNode.queueState == OS_QUEUE_INUSED) && (queueDebugNode.creater == NULL))) {
continue;
}
if ((queueNode.queueState == OS_QUEUE_INUSED) &&

View File

@@ -80,7 +80,7 @@ STATIC VOID OsSemPendedTaskNamePrint(LosSemCB *semNode)
typedef struct {
UINT16 origSemCount; /* Number of original available semaphores */
UINT64 lastAccessTime; /* The last operation time */
TSK_ENTRY_FUNC creator; /* The task entry who created this sem */
TSK_ENTRY_FUNC creater; /* The task entry who created this sem */
} SemDebugCB;
STATIC SemDebugCB *g_semDebugArray = NULL;
@@ -110,10 +110,10 @@ VOID OsSemDbgTimeUpdate(UINT32 semID)
return;
}
VOID OsSemDbgUpdate(UINT32 semID, TSK_ENTRY_FUNC creator, UINT16 count)
VOID OsSemDbgUpdate(UINT32 semID, TSK_ENTRY_FUNC creater, UINT16 count)
{
SemDebugCB *semDebug = &g_semDebugArray[GET_SEM_INDEX(semID)];
semDebug->creator = creator;
semDebug->creater = creater;
semDebug->lastAccessTime = LOS_TickCountGet();
semDebug->origSemCount = count;
return;
@@ -133,7 +133,7 @@ STATIC VOID OsSemSort(UINT32 *semIndexArray, UINT32 usedCount)
/* It will Print out ALL the Used Semaphore List. */
PRINTK("Used Semaphore List: \n");
PRINTK("\r\n SemID Count OriginalCount Creator(TaskEntry) LastAccessTime\n");
PRINTK("\r\n SemID Count OriginalCount Creater(TaskEntry) LastAccessTime\n");
PRINTK(" ------ ------ ------------- ------------------ -------------- \n");
SCHEDULER_LOCK(intSave);
@@ -145,11 +145,11 @@ STATIC VOID OsSemSort(UINT32 *semIndexArray, UINT32 usedCount)
(VOID)memcpy_s(&semNode, sizeof(LosSemCB), semCB, sizeof(LosSemCB));
(VOID)memcpy_s(&semDebug, sizeof(SemDebugCB), &g_semDebugArray[semIndexArray[i]], sizeof(SemDebugCB));
SCHEDULER_UNLOCK(intSave);
if ((semNode.semStat != OS_SEM_USED) || (semDebug.creator == NULL)) {
if ((semNode.semStat != OS_SEM_USED) || (semDebug.creater == NULL)) {
continue;
}
PRINTK(" 0x%-07x0x%-07u0x%-14u%-22p0x%llx\n", semNode.semID, semDebug.origSemCount,
semNode.semCount, semDebug.creator, semDebug.lastAccessTime);
semNode.semCount, semDebug.creater, semDebug.lastAccessTime);
if (!LOS_ListEmpty(&semNode.semList)) {
OsSemPendedTaskNamePrint(semCB);
}
@@ -170,7 +170,7 @@ UINT32 OsSemInfoGetFullData(VOID)
for (i = 0; i < LOSCFG_BASE_IPC_SEM_LIMIT; i++) {
semNode = GET_SEM(i);
semDebug = &g_semDebugArray[i];
if ((semNode->semStat == OS_SEM_USED) && (semDebug->creator != NULL)) {
if ((semNode->semStat == OS_SEM_USED) && (semDebug->creater != NULL)) {
usedSemCnt++;
}
}
@@ -190,7 +190,7 @@ UINT32 OsSemInfoGetFullData(VOID)
for (i = 0; i < LOSCFG_BASE_IPC_SEM_LIMIT; i++) {
semNode = GET_SEM(i);
semDebug = &g_semDebugArray[i];
if ((semNode->semStat != OS_SEM_USED) || (semDebug->creator == NULL)) {
if ((semNode->semStat != OS_SEM_USED) || (semDebug->creater == NULL)) {
continue;
}
*(semIndexArray + count) = i;

View File

@@ -498,7 +498,7 @@ STATIC INLINE VOID OsLmsReallocMergeNodeMark(struct OsMemNodeHead *node)
}
g_lms->simpleMark((UINTPTR)node + OS_MEM_NODE_HEAD_SIZE, (UINTPTR)OS_MEM_NEXT_NODE(node),
LMS_SHADOW_ACCESSIBLE_U8);
LMS_SHADOW_ACCESSABLE_U8);
}
STATIC INLINE VOID OsLmsReallocSplitNodeMark(struct OsMemNodeHead *node)

View File

@@ -271,7 +271,7 @@ VOID OsLockDepCheckOut(SPIN_LOCK_S *lock)
{
UINT32 intSave;
INT32 depth;
enum LockDepErrType checkResult;
enum LockDepErrType checkResult = LOCKDEP_SUCCESS;
VOID *requestAddr = (VOID *)__builtin_return_address(1);
LosTaskCB *current = OsCurrTaskGet();
LosTaskCB *owner = NULL;

View File

@@ -208,12 +208,15 @@ UINT32 OsUProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm)
PADDR_T paddr;
STATUS_T ret;
INT32 shareRef;
UINT32 pmSize = 0;
if (sharePm != NULL) {
*sharePm = 0;
}
if (actualPm != NULL) {
*actualPm = 0;
}
ret = LOS_MuxAcquire(&space->regionMux);
if (ret != 0) {
return 0;
@@ -237,20 +240,19 @@ UINT32 OsUProcessPmUsage(LosVmSpace *space, UINT32 *sharePm, UINT32 *actualPm)
if (sharePm != NULL) {
*sharePm += PAGE_SIZE;
}
pmSize += PAGE_SIZE / shareRef;
if (actualPm != NULL) {
*actualPm += PAGE_SIZE / shareRef;
}
} else {
pmSize += PAGE_SIZE;
if (actualPm != NULL) {
*actualPm += PAGE_SIZE;
}
}
}
RB_SCAN_SAFE_END(&oldVmSpace->regionRbTree, pstRbNode, pstRbNodeNext)
(VOID)LOS_MuxRelease(&space->regionMux);
if (actualPm != NULL) {
*actualPm = pmSize;
}
return pmSize;
return *actualPm;
}
LosProcessCB *OsGetPIDByAspace(LosVmSpace *space)
@@ -303,7 +305,7 @@ UINT32 OsCountRegionPages(LosVmSpace *space, LosVmMapRegion *region, UINT32 *pss
}
if (pssPages != NULL) {
*pssPages = (UINT32)(pss + 0.5); /* 0.5, for page alignment */
*pssPages = (UINT32)(pss + 0.5);
}
return regionPages;

View File

@@ -297,7 +297,7 @@ int OsTryShrinkMemory(size_t nPage)
LosFilePage *fpage = NULL;
LosFilePage *fnext = NULL;
if (nPage == 0) {
if (nPage <= 0) {
nPage = VM_FILEMAP_MIN_SCAN;
}

View File

@@ -166,7 +166,7 @@ MMAP_DONE:
STATUS_T LOS_UnMMap(VADDR_T addr, size_t size)
{
if ((addr <= 0) || (size == 0)) {
if ((addr <= 0) || (size <= 0)) {
return -EINVAL;
}

View File

@@ -404,7 +404,7 @@ STATIC VOID EchoToTerminal(CONSOLE_CB *consoleCB, struct file *filep, const stru
{
if (consoleCB->consoleTermios.c_lflag & ECHO) {
if (ch == '\b') {
(VOID)fops->write(filep, "\b \b", 3); // 3: length of "\b \b"
(VOID)fops->write(filep, "\b \b", 3);
} else {
(VOID)fops->write(filep, &ch, EACH_CHAR);
}
@@ -709,6 +709,7 @@ STATIC ssize_t DoWrite(CirBufSendCB *cirBufSendCB, CHAR *buffer, size_t bufLen)
{
INT32 cnt;
size_t written = 0;
size_t toWrite = bufLen;
UINT32 intSave;
#ifdef LOSCFG_SHELL_DMESG
@@ -729,6 +730,7 @@ STATIC ssize_t DoWrite(CirBufSendCB *cirBufSendCB, CHAR *buffer, size_t bufLen)
if (cnt <= 0) {
break;
}
toWrite -= cnt;
written += cnt;
}
LOS_SpinUnlockRestore(&g_consoleWriteSpinLock, intSave);
@@ -1534,15 +1536,7 @@ STATIC ssize_t WriteToTerminal(const CONSOLE_CB *consoleCB, const CHAR *buffer,
fd = consoleCB->fd;
ret = fs_getfilep(fd, &filep);
if (ret < 0) {
ret = -EPERM;
goto ERROUT;
}
ret = GetFilepOps(filep, &privFilep, &fileOps);
if (ret != ENOERR) {
ret = -EINVAL;
goto ERROUT;
}
if ((fileOps == NULL) || (fileOps->write == NULL)) {
ret = EFAULT;

View File

@@ -87,6 +87,7 @@ STATIC VOID InitLevelCall(const CHAR *name, const UINT32 level, struct ModuleIni
LOS_SpinUnlock(&g_initLock);
if (module->hook != NULL) {
#ifdef LOS_INIT_DEBUG
ret = LOS_OK;
startNsec = LOS_CurrNanosec();
ret = (UINT32)module->hook();
endNsec = LOS_CurrNanosec();

View File

@@ -51,7 +51,7 @@ STATIC BOOL g_srandInit;
STATIC INT32 OsELFOpen(const CHAR *fileName, INT32 oflags)
{
INT32 ret;
INT32 ret = -LOS_NOK;
INT32 procFd;
procFd = AllocProcessFd();

View File

@@ -326,7 +326,7 @@ VOID OsLmsLosMallocMark(const VOID *curNodeStart, const VOID *nextNodeStart, UIN
}
OsLmsSetShadowValue(node, curNodeStartAddr, curNodeStartAddr + nodeHeadSize, LMS_SHADOW_REDZONE_U8);
OsLmsSetShadowValue(node, curNodeStartAddr + nodeHeadSize, nextNodeStartAddr, LMS_SHADOW_ACCESSIBLE_U8);
OsLmsSetShadowValue(node, curNodeStartAddr + nodeHeadSize, nextNodeStartAddr, LMS_SHADOW_ACCESSABLE_U8);
OsLmsSetShadowValue(node, nextNodeStartAddr, nextNodeStartAddr + nodeHeadSize, LMS_SHADOW_REDZONE_U8);
LMS_UNLOCK(intSave);
}
@@ -344,7 +344,7 @@ VOID OsLmsCheckValid(UINTPTR checkAddr, BOOL isFreeCheck)
OsLmsGetShadowValue(node, checkAddr, &shadowValue);
LMS_UNLOCK(intSave);
if ((shadowValue == LMS_SHADOW_ACCESSIBLE) || ((isFreeCheck) && (shadowValue == LMS_SHADOW_PAINT))) {
if ((shadowValue == LMS_SHADOW_ACCESSABLE) || ((isFreeCheck) && (shadowValue == LMS_SHADOW_PAINT))) {
return;
}
@@ -367,7 +367,7 @@ VOID OsLmsLosFreeMark(const VOID *curNodeStart, const VOID *nextNodeStart, UINT3
UINTPTR nextNodeStartAddr = (UINTPTR)nextNodeStart;
OsLmsGetShadowValue(node, curNodeStartAddr + nodeHeadSize, &shadowValue);
if ((shadowValue != LMS_SHADOW_ACCESSIBLE) && (shadowValue != LMS_SHADOW_PAINT)) {
if ((shadowValue != LMS_SHADOW_ACCESSABLE) && (shadowValue != LMS_SHADOW_PAINT)) {
LMS_UNLOCK(intSave);
OsLmsReportError(curNodeStartAddr + nodeHeadSize, MEM_REGION_SIZE_1, FREE_ERRORMODE);
return;
@@ -408,7 +408,7 @@ VOID LOS_LmsAddrDisableProtect(UINTPTR addrStart, UINTPTR addrEnd)
LMS_LOCK(intSave);
LmsMemListNode *node = OsLmsGetPoolNodeFromAddr(addrStart);
if (node != NULL) {
OsLmsSetShadowValue(node, addrStart, addrEnd, LMS_SHADOW_ACCESSIBLE_U8);
OsLmsSetShadowValue(node, addrStart, addrEnd, LMS_SHADOW_ACCESSABLE_U8);
}
LMS_UNLOCK(intSave);
}
@@ -426,7 +426,7 @@ STATIC UINT32 OsLmsCheckAddr(UINTPTR addr)
LmsMemListNode *node = OsLmsGetPoolNodeFromAddr(addr);
if (node == NULL) {
LMS_UNLOCK(intSave);
return LMS_SHADOW_ACCESSIBLE_U8;
return LMS_SHADOW_ACCESSABLE_U8;
}
OsLmsGetShadowValue(node, addr, &shadowValue);
@@ -542,7 +542,7 @@ STATIC VOID OsLmsGetErrorInfo(UINTPTR addr, UINT32 size, LmsAddrInfo *info)
{
LmsMemListNode *node = OsLmsGetPoolNodeFromAddr(addr);
OsLmsGetShadowInfo(node, addr, info);
if (info->shadowValue != LMS_SHADOW_ACCESSIBLE_U8) {
if (info->shadowValue != LMS_SHADOW_ACCESSABLE_U8) {
return;
} else {
OsLmsGetShadowInfo(node, addr + size - 1, info);
@@ -558,7 +558,7 @@ STATIC VOID OsLmsPrintErrInfo(LmsAddrInfo *info, UINT32 errMod)
case LMS_SHADOW_REDZONE:
PRINT_ERR("Heap buffer overflow error detected\n");
break;
case LMS_SHADOW_ACCESSIBLE:
case LMS_SHADOW_ACCESSABLE:
PRINT_ERR("No error\n");
break;
default:
@@ -614,7 +614,7 @@ VOID OsLmsReportError(UINTPTR p, UINT32 size, UINT32 errMod)
#ifdef LOSCFG_LMS_STORE_CHECK
VOID __asan_store1_noabort(UINTPTR p)
{
if (OsLmsCheckAddr(p) != LMS_SHADOW_ACCESSIBLE_U8) {
if (OsLmsCheckAddr(p) != LMS_SHADOW_ACCESSABLE_U8) {
OsLmsReportError(p, MEM_REGION_SIZE_1, STORE_ERRMODE);
}
}
@@ -690,7 +690,7 @@ VOID __asan_storeN_noabort(UINTPTR p, UINT32 size)
#ifdef LOSCFG_LMS_LOAD_CHECK
VOID __asan_load1_noabort(UINTPTR p)
{
if (OsLmsCheckAddr(p) != LMS_SHADOW_ACCESSIBLE_U8) {
if (OsLmsCheckAddr(p) != LMS_SHADOW_ACCESSABLE_U8) {
OsLmsReportError(p, MEM_REGION_SIZE_1, LOAD_ERRMODE);
}
}

View File

@@ -59,13 +59,13 @@ extern "C" {
#define LMS_POOL_RESIZE(size) ((size) / (LMS_SHADOW_U8_REFER_BYTES + 1) * LMS_SHADOW_U8_REFER_BYTES)
#define LMS_ADDR_ALIGN(p) (((UINTPTR)(p) + sizeof(UINTPTR) - 1) & ~((UINTPTR)(sizeof(UINTPTR) - 1)))
#define LMS_SHADOW_ACCESSIBLE 0x00
#define LMS_SHADOW_ACCESSABLE 0x00
#define LMS_SHADOW_AFTERFREE 0x03
#define LMS_SHADOW_REDZONE 0x02
#define LMS_SHADOW_PAINT 0x01
#define LMS_SHADOW_MASK 0x03
#define LMS_SHADOW_ACCESSIBLE_U8 0x00
#define LMS_SHADOW_ACCESSABLE_U8 0x00
#define LMS_SHADOW_AFTERFREE_U8 0xFF
#define LMS_SHADOW_REDZONE_U8 0xAA
#define LMS_SHADOW_MASK_U8 0xFF

View File

@@ -124,8 +124,8 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS void LmsSetShadowValue(uintptr_t startAddr, uintpt
uint32_t startOffset;
uint32_t endOffset;
unsigned char shadowValueMask;
unsigned char shadowValue;
char shadowValueMask;
char shadowValue;
/* endAddr - 1, then we mark [startAddr, endAddr) to value */
LmsMem2Shadow(startAddr, &shadowStart, &startOffset);
@@ -174,7 +174,7 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS void LmsGetShadowValue(uintptr_t addr, uint32_t *s
LmsMem2Shadow(addr, &shadowAddr, &shadowOffset);
/* If the shadow addr is not mapped then regarded as legal access */
if (LmsIsShadowAddrMapped(shadowAddr, shadowAddr) != LMS_OK) {
*shadowValue = LMS_SHADOW_ACCESSIBLE_U8;
*shadowValue = LMS_SHADOW_ACCESSABLE_U8;
return;
}
@@ -185,7 +185,7 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS void LmsMallocMark(uintptr_t preRzStart, uintptr_t
uintptr_t RzEndAddr)
{
LmsSetShadowValue(preRzStart, accessMemStart, LMS_SHADOW_REDZONE_U8);
LmsSetShadowValue(accessMemStart, nextRzStart, LMS_SHADOW_ACCESSIBLE_U8);
LmsSetShadowValue(accessMemStart, nextRzStart, LMS_SHADOW_ACCESSABLE_U8);
LmsSetShadowValue(nextRzStart, RzEndAddr, LMS_SHADOW_REDZONE_U8);
}
@@ -266,7 +266,7 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS void LmsPrintMemInfo(uintptr_t addr)
}
}
LMS_OUTPUT_INFO("|\t[0x%x | %2u]: ", shadowAddr, shadowOffset);
LMS_OUTPUT_INFO("|\t[0x%x | %2d]: ", shadowAddr, shadowOffset);
for (int x = 0; x < printX; x += LMS_MEM_BYTES_PER_SHADOW_CELL) {
LmsGetShadowValue(dumpAddr + x, &shadowValue);
@@ -300,7 +300,7 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS static inline void LmsGetShadowInfo(uintptr_t memA
ATTRIBUTE_NO_SANITIZE_ADDRESS static void LmsGetErrorInfo(uintptr_t addr, size_t size, LmsAddrInfo *info)
{
LmsGetShadowInfo(addr, info);
if (info->shadowValue != LMS_SHADOW_ACCESSIBLE_U8) {
if (info->shadowValue != LMS_SHADOW_ACCESSABLE_U8) {
return;
} else {
LmsGetShadowInfo(addr + size - 1, info);
@@ -316,7 +316,7 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS static void LmsPrintErrInfo(LmsAddrInfo *info, uin
case LMS_SHADOW_REDZONE:
LMS_OUTPUT_ERROR("Heap buffer overflow error detected!\n");
break;
case LMS_SHADOW_ACCESSIBLE:
case LMS_SHADOW_ACCESSABLE:
LMS_OUTPUT_ERROR("No error!\n");
break;
default:
@@ -339,11 +339,11 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS static void LmsPrintErrInfo(LmsAddrInfo *info, uin
break;
}
LMS_OUTPUT_INFO("Shadow memory address: [0x%x : %u] Shadow memory value: [%u] \n", info->shadowAddr,
LMS_OUTPUT_INFO("Shadow memory address: [0x%x : %d] Shadow memory value: [%d] \n", info->shadowAddr,
info->shadowOffset, info->shadowValue);
LMS_OUTPUT_INFO("\n");
LMS_OUTPUT_INFO("%-25s%d\n", "Accessible heap addr", LMS_SHADOW_ACCESSIBLE);
LMS_OUTPUT_INFO("%-25s%d\n", "Accessable heap addr", LMS_SHADOW_ACCESSABLE);
LMS_OUTPUT_INFO("%-25s%d\n", "Heap red zone", LMS_SHADOW_REDZONE);
LMS_OUTPUT_INFO("%-25s%d\n", "Heap freed buffer", LMS_SHADOW_AFTERFREE);
LMS_OUTPUT_INFO("\n");
@@ -373,23 +373,23 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS void LmsReportError(uintptr_t p, size_t size, uint
void LmsCheckValid(const char *dest, const char *src)
{
if (LmsCheckAddr((uintptr_t)dest) != LMS_SHADOW_ACCESSIBLE_U8) {
if (LmsCheckAddr((uintptr_t)dest) != LMS_SHADOW_ACCESSABLE_U8) {
LmsReportError((uintptr_t)dest, MEM_REGION_SIZE_1, STORE_ERRMODE);
return;
}
if (LmsCheckAddr((uintptr_t)src) != LMS_SHADOW_ACCESSIBLE_U8) {
if (LmsCheckAddr((uintptr_t)src) != LMS_SHADOW_ACCESSABLE_U8) {
LmsReportError((uintptr_t)src, MEM_REGION_SIZE_1, LOAD_ERRMODE);
return;
}
for (uint32_t i = 0; *(src + i) != '\0'; i++) {
if (LmsCheckAddr((uintptr_t)dest + i + 1) != LMS_SHADOW_ACCESSIBLE_U8) {
if (LmsCheckAddr((uintptr_t)dest + i + 1) != LMS_SHADOW_ACCESSABLE_U8) {
LmsReportError((uintptr_t)dest + i + 1, MEM_REGION_SIZE_1, STORE_ERRMODE);
return;
}
if (LmsCheckAddr((uintptr_t)src + i + 1) != LMS_SHADOW_ACCESSIBLE_U8) {
if (LmsCheckAddr((uintptr_t)src + i + 1) != LMS_SHADOW_ACCESSABLE_U8) {
LmsReportError((uintptr_t)src + i + 1, MEM_REGION_SIZE_1, LOAD_ERRMODE);
return;
}
@@ -398,7 +398,7 @@ void LmsCheckValid(const char *dest, const char *src)
void __asan_store1_noabort(uintptr_t p)
{
if (LmsCheckAddr(p) != LMS_SHADOW_ACCESSIBLE_U8) {
if (LmsCheckAddr(p) != LMS_SHADOW_ACCESSABLE_U8) {
LmsReportError(p, MEM_REGION_SIZE_1, STORE_ERRMODE);
}
}
@@ -440,7 +440,7 @@ void __asan_storeN_noabort(uintptr_t p, size_t size)
void __asan_load1_noabort(uintptr_t p)
{
if (LmsCheckAddr(p) != LMS_SHADOW_ACCESSIBLE_U8) {
if (LmsCheckAddr(p) != LMS_SHADOW_ACCESSABLE_U8) {
LmsReportError(p, MEM_REGION_SIZE_1, LOAD_ERRMODE);
}
}

View File

@@ -50,7 +50,7 @@ extern "C" {
#define SANITIZER_INTERFACE_ATTRIBUTE
#define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address))
#define LMS_SHADOW_ACCESSIBLE 0x00
#define LMS_SHADOW_ACCESSABLE 0x00
#define LMS_SHADOW_AFTERFREE 0x03
#define LMS_SHADOW_REDZONE 0x02
#define LMS_SHADOW_PAINT 0x01
@@ -61,7 +61,7 @@ extern "C" {
#define LMS_SHADOW_U8_CELL_NUM 4
#define LMS_SHADOW_U8_REFER_BYTES 16
#define LMS_SHADOW_ACCESSIBLE_U8 0x00
#define LMS_SHADOW_ACCESSABLE_U8 0x00
#define LMS_SHADOW_AFTERFREE_U8 0xFF
#define LMS_SHADOW_REDZONE_U8 0xAA
#define LMS_SHADOW_MASK_U8 0xFF

View File

@@ -45,7 +45,7 @@ ATTRIBUTE_NO_SANITIZE_ADDRESS void LmsFree(void *ptr)
if (LmsIsShadowAddrMapped(shadowAddr, shadowAddr) == LMS_OK) {
uint32_t acShadowValue;
LmsGetShadowValue((uintptr_t)ptr, &acShadowValue);
if (acShadowValue != LMS_SHADOW_ACCESSIBLE) {
if (acShadowValue != LMS_SHADOW_ACCESSABLE) {
char erroMode = (acShadowValue == LMS_SHADOW_AFTERFREE ? FREE_ERRORMODE : UNKNOWN_ERROR);
LmsReportError((uintptr_t)ptr, MEM_REGION_SIZE_1, erroMode);
goto UNLOCK_OUT;

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -50,8 +50,8 @@ extern "C" {
* Rwlock object.
*/
typedef struct OsRwlock {
INT32 magic : 24; /**< Magic number */
INT32 rwCount : 8; /**< Times of locking the rwlock, rwCount > 0 when rwkick is read mode, rwCount < 0
INT32 magic:24; /**< Magic number */
INT32 rwCount:8; /**< Times of locking the rwlock, rwCount > 0 when rwkick is read mode, rwCount < 0
when the rwlock is write mode, rwCount = 0 when the lock is free. */
VOID *writeOwner; /**< The current write thread that is locking the rwlock */
LOS_DL_LIST readList; /**< Read waiting list */

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -58,7 +58,7 @@
#define ip_addr_set_val(dest, src) do { \
IP_SET_TYPE_VAL(*dest, IP_GET_TYPE(src)); \
if (IP_IS_V6_VAL(*(src))) { \
if(IP_IS_V6_VAL(*(src))) { \
ip6_addr_set(ip_2_ip6(dest), ip_2_ip6(src)); \
} else { \
ip4_addr_set(ip_2_ip4(dest), ip_2_ip4(src)); \

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -342,7 +342,7 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
buf_len -= (unsigned int)ret;
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " MTU:%d %s", netif->mtu,
(netif->flags & NETIF_FLAG_UP) ? "Running" : "Stop");
netif->flags & NETIF_FLAG_UP ? "Running" : "Stop");
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
goto out;
tmp += ret;
@@ -356,8 +356,7 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
buf_len -= (unsigned int)ret;
}
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n",
(netif->flags & NETIF_FLAG_LINK_UP) ? "Link UP" : "Link Down");
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n", netif->flags & NETIF_FLAG_LINK_UP ? "Link UP" : "Link Down");
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
goto out;
tmp += ret;
@@ -366,19 +365,19 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "\tRX packets:%u ",
netif->mib2_counters.ifinucastpkts + netif->mib2_counters.ifinnucastpkts);
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
goto out;
goto out;
tmp += ret;
buf_len -= (unsigned int)ret;
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "errors:%u ", netif->mib2_counters.ifinerrors);
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
goto out;
goto out;
tmp += ret;
buf_len -= (unsigned int)ret;
ret = snprintf_s(tmp, buf_len, (buf_len - 1), "dropped:%u ", netif->mib2_counters.ifindiscards);
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
goto out;
goto out;
tmp += ret;
buf_len -= (unsigned int)ret;
@@ -1032,12 +1031,12 @@ u32_t lwip_ifconfig(int argc, const char **argv)
#if LWIP_ARP && LWIP_ENABLE_IP_CONFLICT_SIGNAL
if ((ifconfig_cmd.option & IFCONFIG_OPTION_SET_IP) && IP_IS_V4_VAL((ifconfig_cmd.ip_addr))) {
/* Create the semaphore for ip conflict detection. */
if (sys_sem_new(&ip_conflict_detect, 0) != ERR_OK) {
sys_sem_free(&ifconfig_cmd.cb_completed);
PRINTK("ifconfig: internal error\n");
return 1;
}
is_ip_conflict_signal = 1;
if (sys_sem_new(&ip_conflict_detect, 0) != ERR_OK) {
sys_sem_free(&ifconfig_cmd.cb_completed);
PRINTK("ifconfig: internal error\n");
return 1;
}
is_ip_conflict_signal = 1;
}
#endif /* LWIP_ARP && LWIP_ENABLE_IP_CONFLICT_SIGNAL */
@@ -1058,8 +1057,8 @@ u32_t lwip_ifconfig(int argc, const char **argv)
sys_sem_free(&ifconfig_cmd.cb_completed);
#if LWIP_ARP && LWIP_ENABLE_IP_CONFLICT_SIGNAL
if ((ifconfig_cmd.option & IFCONFIG_OPTION_SET_IP) && IP_IS_V4_VAL((ifconfig_cmd.ip_addr))) {
is_ip_conflict_signal = 0;
sys_sem_free(&ip_conflict_detect);
is_ip_conflict_signal = 0;
sys_sem_free(&ip_conflict_detect);
}
#endif /* LWIP_ARP && LWIP_ENABLE_IP_CONFLICT_SIGNAL */
@@ -1077,37 +1076,37 @@ u32_t lwip_ifconfig(int argc, const char **argv)
ifconfig_cmd.cb_print_buf[PRINT_BUF_LEN - 1] = '\0';
PRINTK("%s", ifconfig_cmd.cb_print_buf);
#if LWIP_ARP && LWIP_ENABLE_IP_CONFLICT_SIGNAL
/* Pend 2 seconds for waiting the arp reply if the ip is already in use. */
/* Pend 2 seconds for waiting the arp reply if the ip is already in use.*/
if ((ifconfig_cmd.option & IFCONFIG_OPTION_SET_IP) && IP_IS_V4_VAL((ifconfig_cmd.ip_addr))) {
err = (err_t)sys_arch_sem_wait(&ip_conflict_detect, DUP_ARP_DETECT_TIME);
is_ip_conflict_signal = 0;
sys_sem_free(&ip_conflict_detect);
if (err < 0) {
/* The result neither conflict nor timeout. */
PRINT_ERR("ifconfig: internal error\n");
sys_sem_free(&ifconfig_cmd.cb_completed);
return 1;
} else if (err < DUP_ARP_DETECT_TIME) {
/* Duplicate use of new ip, restore it to the old one. */
PRINT_ERR("ifconfig: ip conflict!\n");
ip_addr_set_ip4_u32_val(ifconfig_cmd.ip_addr, old_ip4addr);
ret = tcpip_callback(lwip_ifconfig_internal, &ifconfig_cmd);
if (ret != ERR_OK) {
sys_sem_free(&ifconfig_cmd.cb_completed);
PRINTK("%s : tcpip_callback failed in line %d : errnu %d", __FUNCTION__, __LINE__, ret);
return 1;
}
(void)sys_arch_sem_wait(&ifconfig_cmd.cb_completed, 0);
sys_sem_free(&ifconfig_cmd.cb_completed);
ifconfig_cmd.cb_print_buf[PRINT_BUF_LEN - 1] = '\0';
PRINTK("%s", ifconfig_cmd.cb_print_buf);
return 1;
err = (err_t)sys_arch_sem_wait(&ip_conflict_detect, DUP_ARP_DETECT_TIME);
is_ip_conflict_signal = 0;
sys_sem_free(&ip_conflict_detect);
if (err < 0) {
/* The result neither conflict nor timeout. */
PRINT_ERR("ifconfig: internal error\n");
sys_sem_free(&ifconfig_cmd.cb_completed);
return 1;
} else if (err < DUP_ARP_DETECT_TIME) {
/* Duplicate use of new ip, restore it to the old one. */
PRINT_ERR("ifconfig: ip conflict!\n");
ip_addr_set_ip4_u32_val(ifconfig_cmd.ip_addr, old_ip4addr);
ret = tcpip_callback(lwip_ifconfig_internal, &ifconfig_cmd);
if (ret != ERR_OK) {
sys_sem_free(&ifconfig_cmd.cb_completed);
PRINTK("%s : tcpip_callback failed in line %d : errnu %d", __FUNCTION__, __LINE__, ret);
return 1;
}
(void)sys_arch_sem_wait(&ifconfig_cmd.cb_completed, 0);
sys_sem_free(&ifconfig_cmd.cb_completed);
ifconfig_cmd.cb_print_buf[PRINT_BUF_LEN - 1] = '\0';
PRINTK("%s", ifconfig_cmd.cb_print_buf);
return 1;
}
}
#endif /* LWIP_ARP && LWIP_ENABLE_IP_CONFLICT_SIGNAL */
#if LWIP_IPV6
if ((ifconfig_cmd.option & IFCONFIG_OPTION_SET_IP) && IP_IS_V6_VAL(ifconfig_cmd.ip_addr)) {
/* Pend 2 seconds for waiting the arp reply if the ip is already in use. */
/* Pend 2 seconds for waiting the arp reply if the ip is already in use.*/
retval = sys_arch_sem_wait(&dup_addr_detect, DUP_ARP_DETECT_TIME);
is_dup_detect_initialized = 0;
sys_sem_free(&dup_addr_detect);
@@ -1192,6 +1191,7 @@ void lwip_arp_show_internal(struct netif *netif, char *printf_buf, unsigned int
|| (state == ETHARP_STATE_STATIC)
#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */
) && arp_table[i].netif) {
if (strcmp(netif_get_name(netif), netif_get_name(arp_table[i].netif)) != 0) {
continue;
}
@@ -1305,7 +1305,7 @@ void lwip_arp_internal(void *arg)
for (netif = netif_list; netif != NULL; netif = netif->next) {
ret = etharp_delete_arp_entry(netif, &ipaddr);
if (ret == ERR_OK) {
/* only can del success one time */
/*only can del success one time*/
break;
}
}
@@ -1387,7 +1387,7 @@ u32_t lwip_arp(int argc, const char **argv)
goto arp_error;
}
i += 2;
argc -= 2; // 2: number of used parameters
argc -= 2;
} else if (strcmp("-d", argv[i]) == 0 && (argc > 1)) {
/* arp delete */
arp_cmd.option = ARP_OPTION_DEL;
@@ -1399,8 +1399,8 @@ u32_t lwip_arp(int argc, const char **argv)
}
i += 2;
argc -= 2; // 2: number of used parameters
} else if (strcmp("-s", argv[i]) == 0 && (argc > 2)) { // 2: require more than 2 parameters
argc -= 2;
} else if (strcmp("-s", argv[i]) == 0 && (argc > 2)) {
/* arp add */
char *digit = NULL;
u32_t macaddrlen = strlen(argv[i + 2]) + 1;
@@ -1418,7 +1418,7 @@ u32_t lwip_arp(int argc, const char **argv)
goto arp_error;
}
/* cannot add an arp entry of 127.*.*.* */
/*cannot add an arp entry of 127.*.*.* */
if ((arp_cmd.ipaddr & (u32_t)0x0000007fUL) == (u32_t)0x0000007fUL) {
PRINTK("IP address is not correct!\n");
goto arp_error;
@@ -1452,7 +1452,7 @@ u32_t lwip_arp(int argc, const char **argv)
}
i += 3;
argc -= 3; // 3: number of used parameters
argc -= 3;
} else {
goto arp_error;
}
@@ -1727,7 +1727,7 @@ LWIP_STATIC int osPingFunc(u32_t destip, u32_t cnt, u32_t interval, u32_t data_l
break;
}
intrvl -= 1000;
sys_msleep(1000); // 1000: delay 1 s
sys_msleep(1000);
if (ping_kill == 1)
break;
} while (intrvl > 0);
@@ -1819,7 +1819,7 @@ u32_t osShellPing(int argc, const char **argv)
count = ret;
count_set = 1;
i += 2;
argc -= 2; // 2: nuber of arguments that has been checked
argc -= 2;
} else if (strcmp("-t", argv[i]) == 0) {
count = 0; /* ping forerver */
count_set = 1;
@@ -1834,7 +1834,7 @@ u32_t osShellPing(int argc, const char **argv)
interval = ret;
i += 2;
argc -= 2; // 2:number of arguments that has been checked
argc -= 2;
} else if (strcmp("-l", argv[i]) == 0 && (argc > 1)) {
ret = atoi(argv[i + 1]);
if (ret < 0 || ret > (int)(LWIP_MAX_UDP_RAW_SEND_SIZE - sizeof(struct icmp_echo_hdr))) {
@@ -1844,7 +1844,7 @@ u32_t osShellPing(int argc, const char **argv)
}
data_len = ret;
i += 2;
argc -= 2; // 2: number of elements has been checked
argc -= 2;
} else if (strcmp("-k", argv[i]) == 0) {
if (ping_taskid > 0) {
ping_kill = 1; /* stop the current ping task */
@@ -1896,7 +1896,7 @@ u32_t osShellPing(int argc, const char **argv)
stPingTask.auwArgs[0] = dst_ipaddr.addr; /* network order */
stPingTask.auwArgs[1] = count;
stPingTask.auwArgs[2] = interval;
stPingTask.auwArgs[3] = data_len; // 3: index of data length
stPingTask.auwArgs[3] = data_len;
ret = LOS_TaskCreate((UINT32 *)(&ping_taskid), &stPingTask);
if (ret != LOS_OK) {
PRINTK("ping_task create failed 0x%08x.\n", ret);
@@ -1923,7 +1923,7 @@ ping_error:
SHELLCMD_ENTRY(ping_shellcmd, CMD_TYPE_EX, "ping", XARGS, (CmdCallBackFunc)osShellPing);
#endif /* LOSCFG_SHELL */
#else /* LWIP_EXT_POLL_SUPPORT */
#else /* LWIP_EXT_POLL_SUPPORT*/
u32_t osShellPing(int argc, const char **argv)
{
@@ -2076,7 +2076,7 @@ FAILURE:
SHELLCMD_ENTRY(ping_shellcmd, CMD_TYPE_EX, "ping", XARGS, (CmdCallBackFunc)osShellPing);
#endif /* LOSCFG_SHELL */
#endif /* LWIP_EXT_POLL_SUPPORT */
#endif /* LWIP_EXT_POLL_SUPPORT*/
#if LWIP_IPV6
u32_t osShellPing6(int argc, const char **argv)
@@ -2311,7 +2311,6 @@ REDUCE_SELECT_TIME:
PRINTK("--- %s ping statistics ---\n", argv[ping6_params.host_index]);
PRINTK("%d packets transmitted, %d received, %.2f%% packet loss, time %dms\n",
nsent, nrecieve, (float)(((float)(nsent - nrecieve)) * ((float)(100)) / ((float)(nsent))),
/* 1000: convert seconds to milliseconds, 1000000: convert nanoseconds to milliseconds */
((last.tv_sec - first.tv_sec) * 1000 + (last.tv_nsec - first.tv_nsec) / 1000000));
if (nrecieve) {
/* Display rtt stats only if at least one packet is received */
@@ -2630,7 +2629,7 @@ usage:
SHELLCMD_ENTRY(ntpdate_shellcmd, CMD_TYPE_EX, "ntpdate", XARGS, (CmdCallBackFunc)osShellNtpdate);
#endif /* LOSCFG_SHELL_CMD_DEBUG */
#endif /* LWIP_SNTP */
#endif /* LWIP_SNTP*/
#if LWIP_DNS
u32_t osShellDns(int argc, const char **argv)
@@ -2867,7 +2866,7 @@ int netstat_tcp_recvq(struct tcp_pcb *tpcb)
case NETCONN_UDP_IPV6:
#endif
case NETCONN_UDP:
SYS_ARCH_GET(((unsigned int)conn->recv_avail), retVal); // + conn->lrcv_left
SYS_ARCH_GET(((unsigned int)conn->recv_avail /*+ conn->lrcv_left*/), retVal);
break;
default:
retVal = 0; /* ur... very ugly, damn DHCP DNS and SNTP */
@@ -2923,7 +2922,7 @@ int netstat_udp_sendq6(struct udp_pcb *upcb)
#else
ret = netstat_get_udp_sendQLen6(upcb, neighbor_cache[idx].q);
if (ret >= 0) {
retLen += ret;
retLen += ret;
}
#endif
return retLen;
@@ -2967,10 +2966,10 @@ int netstat_udp_sendq(struct udp_pcb *upcb)
#else
ret = netstat_get_udp_sendQLen(upcb, arp_table[arpidx].q);
if (ret > 0) {
retLen += ret;
if (retLen <= 0) { // overflow, set rteLen = -1 to indicate
retLen = -1;
}
retLen += ret;
if (retLen <= 0) { // overflow, set rteLen = -1 to indicate
retLen = -1;
}
}
#endif
}
@@ -2993,7 +2992,7 @@ int netstat_netconn_recvq(const struct netconn *conn)
case NETCONN_PKT_RAW:
#endif
case NETCONN_UDP:
SYS_ARCH_GET(((unsigned int)conn->recv_avail), retVal); // + conn->lrcv_left
SYS_ARCH_GET(((unsigned int)conn->recv_avail /*+ conn->lrcv_left*/), retVal);
break;
default:
retVal = 0; /* ur... very ugly, damn DHCP DNS and SNTP */
@@ -3020,8 +3019,8 @@ int netstat_netconn_sendq(struct netconn *conn)
#if PF_PKT_SUPPORT
case NETCONN_PKT_RAW:
retVal = 0; /* always be 0 as frame send to driver directly */
break;
#endif
break;
case NETCONN_UDP:
retVal = netstat_udp_sendq(conn->pcb.udp);
break;
@@ -3272,10 +3271,10 @@ void netstat_internal(void *ctx)
recvQlen = netstat_netconn_recvq(rpcb->recv_arg);
sendQlen = netstat_netconn_sendq(rpcb->recv_arg);
proto = rpcb->protocol; // raw_proto;
proto = rpcb->protocol;//raw_proto;
iRet = snprintf_s((char *)(entry_buf + entry_buf_offset), entry_buf_len, entry_buf_len - 1,
"%-8s%-12d%-12d%-20s%-20s%-16u%-16d\n",
"raw", recvQlen, sendQlen, local_ip_port, remote_ip_port, proto, 0); // rpcb->hdrincl
"raw", recvQlen, sendQlen, local_ip_port, remote_ip_port, proto, /*rpcb->hdrincl*/0);
if ((iRet <= 0) || ((u32_t)(iRet) >= entry_buf_len)) {
goto out;
}
@@ -3298,8 +3297,7 @@ void netstat_internal(void *ctx)
sendQlen = netstat_netconn_sendq(rpcb->recv_arg);
for (netif = netif_list; netif != NULL; netif = netif->next) {
/* netif->ifindex and index */
if (netif_get_index(netif) == rpcb->netif_idx) {
if (netif_get_index(netif)/*netif->ifindex*/ == rpcb->netif_idx/*index*/) {
(void)snprintf_s((char *)netif_name, IFNAMSIZ, IFNAMSIZ - 1, "%s", netif_get_name(netif));
break;
}
@@ -3309,7 +3307,7 @@ void netstat_internal(void *ctx)
(void)snprintf_s((char *)netif_name, IFNAMSIZ, IFNAMSIZ - 1, "%s", "None");
}
proto = rpcb->protocol; // ntohs(rpcb->proto.eth_proto);
proto = rpcb->protocol;//ntohs(rpcb->proto.eth_proto);
iRet = snprintf_s((char *)(entry_buf + entry_buf_offset), entry_buf_len, entry_buf_len - 1,
"%-12s%-12d%-12d%-16x%-12s\n", "pkt-raw", recvQlen, sendQlen, proto, netif_name);
@@ -3798,9 +3796,8 @@ u32_t osShellIpDebug(int argc, const char **argv)
PRINTK("%-50s ", acIPv6Addr);
if (snprintf_s(aclladdr, sizeof(aclladdr), sizeof(aclladdr) - 1, "%02X:%02X:%02X:%02X:%02X:%02X",
neighbor_cache[i].lladdr[0], neighbor_cache[i].lladdr[1], /* 0, 1, member number */
neighbor_cache[i].lladdr[2], neighbor_cache[i].lladdr[3], /* 2, 3, member number */
neighbor_cache[i].lladdr[4], neighbor_cache[i].lladdr[5]) < 0) { /* 4, 5, member number */
neighbor_cache[i].lladdr[0], neighbor_cache[i].lladdr[1], neighbor_cache[i].lladdr[2],
neighbor_cache[i].lladdr[3], neighbor_cache[i].lladdr[4], neighbor_cache[i].lladdr[5]) < 0) {
return LOS_NOK;
}
PRINTK("%-25s ", aclladdr);
@@ -3887,4 +3884,4 @@ SHELLCMD_ENTRY(reboot_shellcmd, CMD_TYPE_EX, "reboot", XARGS, (CmdCallBackFunc)o
#endif /* LOSCFG_SHELL_CMD_DEBUG */
#endif
#endif // LWIP_ENABLE_LOS_SHELL_CMD
#endif //LWIP_ENABLE_LOS_SHELL_CMD

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -435,9 +435,9 @@ LWIP_STATIC void handle_discover(struct netif *netif, struct dhcps *dhcps,
}
#else
else {
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE,
("handle_discover: sendto(OFFER, IP_ADDR_BROADCAST, DHCP_CLIENT_PORT)\n"));
(void)udp_sendto_if_src(dhcps->pcb, out_msg, IP_ADDR_BROADCAST, DHCP_CLIENT_PORT, netif, &(netif->ip_addr));
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE,
("handle_discover: sendto(OFFER, IP_ADDR_BROADCAST, DHCP_CLIENT_PORT)\n"));
(void)udp_sendto_if_src(dhcps->pcb, out_msg, IP_ADDR_BROADCAST, DHCP_CLIENT_PORT, netif, &(netif->ip_addr));
}
#endif

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -412,7 +412,7 @@ int ip6addr_aton(const char *cp, ip6_addr_t *addr)
int squash_pos = ipv6_blocks;
int i;
const char *s = cp;
const char *ss = cp - 1;
const char *ss = cp-1;
for (; ; s++) {
if (current_block_index >= ipv6_blocks) {

View File

@@ -34,8 +34,8 @@
#if LWIP_PERF
#define PERF_START do {} while (0) /* something to do */
#define PERF_STOP(x) do {} while (0) /* something to do */
#define PERF_START do {/* something to do */} while (0)
#define PERF_STOP(x) do {/* something to do */} while (0)
#endif

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -98,10 +98,10 @@ driverif_output(struct netif *netif, struct pbuf *p)
#if PF_PKT_SUPPORT
if (all_pkt_raw_pcbs != NULL) {
p->flags = (u16_t)(p->flags & ~(PBUF_FLAG_LLMCAST | PBUF_FLAG_LLBCAST | PBUF_FLAG_HOST));
p->flags |= PBUF_FLAG_OUTGOING;
(void)raw_pkt_input(p, netif, NULL);
}
p->flags = (u16_t)(p->flags & ~(PBUF_FLAG_LLMCAST | PBUF_FLAG_LLBCAST | PBUF_FLAG_HOST));
p->flags |= PBUF_FLAG_OUTGOING;
(void)raw_pkt_input(p, netif, NULL);
}
#endif
#if ETH_PAD_SIZE

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@@ -803,10 +803,12 @@ static u8_t lwip_ioctl_internal_SIOCSIFHWADDR(struct ifreq *ifr)
}
#endif
else {
/* bring netif down to clear all Neighbor Cache Entry */
(void)netif_set_down(netif);
ret = netif_set_hwaddr(netif, (const unsigned char *)ifr->ifr_hwaddr.sa_data, netif->hwaddr_len);
if (ret != ERR_OK) {
(void)netif_set_up(netif);
return err_to_errno(ret);
@@ -977,6 +979,7 @@ static u8_t lwip_ioctl_internal_SIOCGIFFLAGS(struct ifreq *ifr)
#endif /* LWIP_IGMP || LWIP_IPV6_MLD */
#if LWIP_DHCP
//if ((netif->flags & NETIF_FLAG_DHCP) != 0) {
if (dhcp_supplied_address(netif)) {
ifr->ifr_flags = (short)((unsigned short)ifr->ifr_flags | IFF_DYNAMIC);
} else {
@@ -1087,6 +1090,7 @@ static u8_t lwip_ioctl_internal_SIOCSIFNAME(struct ifreq *ifr)
#endif
netif = netif_find(ifr->ifr_name);
if (netif == NULL) {
return ENODEV;
} else if (netif->link_layer_type == LOOPBACK_IF) {
@@ -1161,6 +1165,7 @@ static u8_t lwip_ioctl_internal_SIOCGIFMTU(struct ifreq *ifr)
/* get netif hw addr */
netif = netif_find(ifr->ifr_name);
if (netif == NULL) {
return ENODEV;
} else {

View File

@@ -160,7 +160,7 @@ static VOID ReleaseVid(UINT16 vid)
a = vid >> INT_BIT_SHIFT;
b = vid & (INT_BIT_COUNT - 1);
idMap->bitMap[a] &= ~(1U << b);
idMap->bitMap[a] &= ~(1 << b);
/* shrink bit map */
if (mapMaxNum > 1) {

View File

@@ -34,9 +34,9 @@
#include "los_typedef.h"
#include "los_process_pri.h"
#define INT_BIT_COUNT 32U
#define INT_BIT_SHIFT 5U
#define VID_MAP_MAX_NUM 32U
#define INT_BIT_COUNT 32
#define INT_BIT_SHIFT 5
#define VID_MAP_MAX_NUM 32
#define MAX_INVALID_TIMER_VID (VID_MAP_MAX_NUM * INT_BIT_COUNT)

View File

@@ -145,7 +145,7 @@ INT32 CmdLog(INT32 argc, const CHAR **argv)
}
} else if (!strncmp(argv[0], "module", strlen(argv[0]) + 1)) {
module = strtoul(argv[1], &p, 0);
if ((*p != 0) || (module > MODULE4)) {
if ((*p != 0) || (module > MODULE4) || (module < MODULE0)) {
PRINTK("log %s can't access %s\n", argv[0], argv[1]);
PRINTK("not support yet\n");
return -1;

View File

@@ -329,7 +329,7 @@ END:
LITE_OS_SEC_TEXT_MINOR UINT32 ShellEntry(UINTPTR param)
{
CHAR ch;
INT32 n;
INT32 n = 0;
ShellCB *shellCB = (ShellCB *)param;
CONSOLE_CB *consoleCB = OsGetConsoleByID((INT32)shellCB->consoleID);

View File

@@ -425,7 +425,7 @@ STATIC VOID OsBufFullWrite(const CHAR *dst, UINT32 logLen)
STATIC VOID OsWriteTailToHead(const CHAR *dst, UINT32 logLen)
{
UINT32 writeLen;
UINT32 writeLen = 0;
UINT32 bufSize = g_logBufSize;
UINT32 logSize = g_dmesgInfo->logSize;
UINT32 tail = g_dmesgInfo->logTail;

View File

@@ -263,7 +263,7 @@ SYSCALL_HAND_DEF(__NR_statx, SysStatx, int, ARG_NUM_5)
SYSCALL_HAND_DEF(__NR_pthread_set_detach, SysUserThreadSetDetach, int, ARG_NUM_1)
SYSCALL_HAND_DEF(__NR_pthread_join, SysThreadJoin, int, ARG_NUM_1)
SYSCALL_HAND_DEF(__NR_pthread_deatch, SysUserThreadDetach, int, ARG_NUM_1)
SYSCALL_HAND_DEF(__NR_create_user_thread, SysCreateUserThread, unsigned int, ARG_NUM_3)
SYSCALL_HAND_DEF(__NR_creat_user_thread, SysCreateUserThread, unsigned int, ARG_NUM_3)
SYSCALL_HAND_DEF(__NR_getrusage, SysGetrusage, int, ARG_NUM_2)
SYSCALL_HAND_DEF(__NR_sysconf, SysSysconf, long, ARG_NUM_1)
SYSCALL_HAND_DEF(__NR_ugetrlimit, SysUgetrlimit, int, ARG_NUM_2)

View File

@@ -83,10 +83,6 @@ int GetFullpath(int fd, const char *path, char **fullpath)
fd = GetAssociatedSystemFd(fd);
}
ret = fs_getfilep(fd, &file);
if (ret < 0) {
ret = -EPERM;
goto OUT;
}
if (file) {
ret = stat(file->f_path, &bufRet);
if (!ret) {

View File

@@ -86,14 +86,14 @@ extern "C" {
#endif /* __cpluscplus */
#endif /* __cpluscplus */
#define TEST_TASK_PARAM_INIT(testTask, task_name, entry, prio) \
do { \
(void)memset_s(&(testTask), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S)); \
testTask.pfnTaskEntry = (TSK_ENTRY_FUNC)entry; \
testTask.uwStackSize = 0x1000; \
testTask.pcName = task_name; \
testTask.usTaskPrio = prio; \
testTask.uwResved = LOS_TASK_STATUS_DETACHED; \
#define TEST_TASK_PARAM_INIT(testTask, task_name, entry, prio) \
do { \
memset(&testTask, 0, sizeof(TSK_INIT_PARAM_S)); \
testTask.pfnTaskEntry = (TSK_ENTRY_FUNC)entry; \
testTask.uwStackSize = 0x1000; \
testTask.pcName = task_name; \
testTask.usTaskPrio = prio; \
testTask.uwResved = LOS_TASK_STATUS_DETACHED; \
} while (0);
#ifdef LOSCFG_KERNEL_SMP

View File

@@ -50,7 +50,7 @@ VOID RecordIntrTrace(INT32 irq, INT32 direction)
VOID ResetIntrTrace(VOID)
{
g_traceIdx = 0;
(void)memset_s(g_intrTrace, RECORD_SIZE, 0, RECORD_SIZE);
memset(g_intrTrace, 0, RECORD_SIZE);
}
UINT32 CheckIntrTrace(UINT32 *expect, UINT32 num)

View File

@@ -44,7 +44,7 @@ static VOID NestingPrioHigh(INT32 irq, VOID *data)
{
g_intrHandleEnd = 1;
UINT32 temp[0x100][2] = {0};
(void)memset_s(temp, sizeof(UINT32) * 0x100 * 2, 1, sizeof(UINT32) * 0x100 * 2); // 2, buffer size.
memset(temp, 1, sizeof(UINT32) * 0x100 * 2); // 2, buffer size.
}
static VOID TaskF01(VOID)

View File

@@ -58,7 +58,7 @@ static UINT32 Testcase(void)
// 32, number of cycles
for (index = 0; index < 32; index++) {
task1.usTaskPrio = index;
(void)snprintf_s(acName, TASK_NAME_NUM, TASK_NAME_NUM - 1, "Tsk040A%2d", index);
snprintf(acName, 10, "Tsk040A%2d", index); // 10, snprintf size.
task1.pcName = acName;
task1.uwResved = LOS_TASK_STATUS_DETACHED;

View File

@@ -58,10 +58,9 @@ EXIT:
static UINT32 Testcase(void)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
LOS_EventInit(&g_eventCb01);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "Tsk082A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -142,8 +142,7 @@ static UINT32 Testcase(void)
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk118B";

View File

@@ -142,8 +142,7 @@ static UINT32 Testcase(void)
ret = LOS_TaskCreate(&g_testTaskID01, &task1);
ICUNIT_ASSERT_EQUAL(ret, LOS_OK, ret);
ret = memset_s(&task1, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
task1.uwStackSize = TASK_STACK_SIZE_TEST;
task1.pcName = "Tsk118B";

View File

@@ -80,8 +80,7 @@ static UINT32 Testcase(void)
currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM;
#endif
ret = memset_s(&task, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_GOTO_EQUAL(ret, 0, ret, EXIT);
memset(&task, 0, sizeof(TSK_INIT_PARAM_S));
task.pfnTaskEntry = (TSK_ENTRY_FUNC)ItTimeslice001F01;
task.usTaskPrio = TASK_PRIO_TEST_TASK + 1;
task.pcName = "it_timeslice_001_f01";

View File

@@ -99,8 +99,7 @@ static UINT32 Testcase(void)
currCpuid = (ArchCurrCpuid() + 1) % LOSCFG_KERNEL_CORE_NUM;
#endif
ret = memset_s(&task, sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
memset(&task, 0, sizeof(TSK_INIT_PARAM_S));
task.pfnTaskEntry = (TSK_ENTRY_FUNC)ItTimeslice002F01;
task.usTaskPrio = TASK_PRIO_TEST_TASK + 1;
task.pcName = "it_timeslice_002_f01";

View File

@@ -57,8 +57,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk1";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -60,8 +60,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk2";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -56,8 +56,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk3";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -57,8 +57,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk4";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -62,8 +62,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk6";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -88,8 +88,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk7";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -62,8 +62,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk8";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -70,8 +70,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk9";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -62,8 +62,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk10";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -69,8 +69,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk11";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -74,8 +74,8 @@ static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk12";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -75,8 +75,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk13";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -67,8 +67,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk14";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -65,8 +65,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk15";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -60,8 +60,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk16";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -74,8 +74,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EvtTsk18A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -83,8 +83,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EvtTsk19A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -84,8 +84,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EvtTsk20A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -54,8 +54,8 @@ EXIT:
static VOID TaskF01(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF02;
task1.pcName = "EvtTsk21B";
task1.uwStackSize = TASK_STACK_SIZE_TEST;
@@ -85,8 +85,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EvtTsk21A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -73,8 +73,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EvtTsk22A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -92,8 +92,9 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EvtTsk23A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -66,8 +66,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk26";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -48,9 +48,8 @@ static VOID SwtmrF01(VOID)
g_eventMask = g_eventMask | (1 << g_testCount);
if (g_testCount > 17) { // g_testCount > 17, do noting return
if (g_testCount > 17) // g_testCount > 17, do noting return
return;
}
ret = LOS_EventWrite(&g_event, g_eventMask);
ICUNIT_ASSERT_EQUAL_VOID(ret, LOS_OK, ret);
@@ -82,8 +81,8 @@ static UINT32 Testcase(VOID)
UINT16 swTmrID;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk27";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -55,9 +55,10 @@ static UINT32 Testcase(VOID)
{
UINT32 ret;
UINT32 event;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
LOS_EventInit(&g_event);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk29";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -52,8 +52,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk30";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -83,11 +83,12 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
g_testCount = 0;
LOS_EventInit(&g_event);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk32A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -96,11 +96,12 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
g_testCount = 0;
LOS_EventInit(&g_event);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk33A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -60,9 +60,9 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
LOS_EventInit(&g_event);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk37";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -104,12 +104,13 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
LOS_EventInit(&g_event);
LOS_EventInit(&g_pevent2);
g_testCount = 0;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk38A";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -56,8 +56,10 @@ static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = { 0 };
LOS_EventInit(&g_event);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk39";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -55,8 +55,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk40";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -56,9 +56,9 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
EVENT_CB_S pevent = { 0 };
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk42";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -81,8 +81,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk43";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -56,10 +56,11 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
LOS_EventInit(&g_event);
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk36";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -57,8 +57,8 @@ EXIT:
static UINT32 Testcase(VOID)
{
UINT32 ret;
TSK_INIT_PARAM_S task1 = {0};
TSK_INIT_PARAM_S task1;
memset(&task1, 0, sizeof(TSK_INIT_PARAM_S));
task1.pfnTaskEntry = (TSK_ENTRY_FUNC)TaskF01;
task1.pcName = "EventTsk41";
task1.uwStackSize = TASK_STACK_SIZE_TEST;

View File

@@ -46,8 +46,7 @@ static UINT32 Testcase(VOID)
g_testQueueID01 = 0;
ret = memset_s(bufname, 5001, 'a', 5001); // 5001, buffer size.
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
memset(bufname, 'a', 5001); // 5001, buffer size.
bufname[5001] = '\0'; // 5001, buffer size.
ret = LOS_QueueCreate(bufname, 3, &g_testQueueID01, 0, sizeof(UINTPTR)); // 3, Set the queue length.
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);

Some files were not shown because too many files have changed in this diff Show More