From a706de2fad79964e38a5506884f538c3983b5543 Mon Sep 17 00:00:00 2001 From: laokz Date: Sun, 6 Dec 2020 13:21:22 +0800 Subject: [PATCH] fix hilog, vm_syscall etc. typos --- kernel/base/ipc/los_sem_debug.c | 2 +- kernel/base/mem/common/los_memstat.c | 4 ++-- kernel/base/vm/los_vm_scan.c | 2 +- kernel/base/vm/los_vm_syscall.c | 13 ++++++------- kernel/common/los_hilog.c | 7 ++++--- security/vid/vid.c | 1 + syscall/time_syscall.c | 6 +++--- 7 files changed, 18 insertions(+), 17 deletions(-) diff --git a/kernel/base/ipc/los_sem_debug.c b/kernel/base/ipc/los_sem_debug.c index 73a6f2d8..148ee90a 100644 --- a/kernel/base/ipc/los_sem_debug.c +++ b/kernel/base/ipc/los_sem_debug.c @@ -71,7 +71,7 @@ STATIC VOID OsSemPendedTaskNamePrint(LosSemCB *semNode) PRINTK("Pended task list : "); for (i = 0; i < num; i++) { if (i == 0) { - PRINTK("%s\n", nameArr[i]); + PRINTK("\n%s", nameArr[i]); } else { PRINTK(", %s", nameArr[i]); } diff --git a/kernel/base/mem/common/los_memstat.c b/kernel/base/mem/common/los_memstat.c index 5140d452..dea9dbdf 100644 --- a/kernel/base/mem/common/los_memstat.c +++ b/kernel/base/mem/common/los_memstat.c @@ -83,7 +83,7 @@ LITE_OS_SEC_TEXT_MINOR VOID OsTaskMemClear(UINT32 taskID) } if (g_tskMemUsedInfo[taskID].memUsed != 0) { PRINT_WARN("mem used of task '%s' is:0x%x, not zero when task being deleted\n", - OsCurrTaskGet()->taskName, g_tskMemUsedInfo[taskID].memUsed); + OS_TCB_FROM_TID(taskID)->taskName, g_tskMemUsedInfo[taskID].memUsed); } g_tskMemUsedInfo[taskID].memUsed = 0; } @@ -123,4 +123,4 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsTaskSlabUsage(UINT32 taskID) #if __cplusplus } #endif /* __cplusplus */ -#endif /* __cplusplus */ \ No newline at end of file +#endif /* __cplusplus */ diff --git a/kernel/base/vm/los_vm_scan.c b/kernel/base/vm/los_vm_scan.c index 13d20de3..38277254 100644 --- a/kernel/base/vm/los_vm_scan.c +++ b/kernel/base/vm/los_vm_scan.c @@ -337,7 +337,7 @@ int OsTryShrinkMemory(size_t nPage) return nReclaimed; } #else -int TryShrinkMemory(size_t nPage) +int OsTryShrinkMemory(size_t nPage) { return 0; } diff --git a/kernel/base/vm/los_vm_syscall.c b/kernel/base/vm/los_vm_syscall.c index 1a3b8194..a8f85eec 100644 --- a/kernel/base/vm/los_vm_syscall.c +++ b/kernel/base/vm/los_vm_syscall.c @@ -179,11 +179,15 @@ VOID *LOS_DoBrk(VOID *addr) if (LOS_UnMMap(newBrk, (oldBrk - newBrk)) < 0) { return (void *)(UINTPTR)space->heapNow; } - space->heapNow = (VADDR_T)(UINTPTR)addr; - return addr; + space->heapNow = (VADDR_T)(UINTPTR)alignAddr; + return alignAddr; } (VOID)LOS_MuxAcquire(&space->regionMux); + if ((UINTPTR)alignAddr >= space->mapBase) { + VM_ERR("Process heap memory space is insufficient"); + return (VOID *)-ENOMEM; + } if (space->heapBase == space->heapNow) { region = LOS_RegionAlloc(space, space->heapBase, size, VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE | @@ -197,11 +201,6 @@ VOID *LOS_DoBrk(VOID *addr) space->heap = region; } - if ((UINTPTR)alignAddr >= space->mapBase) { - VM_ERR("Process heap memory space is insufficient"); - goto REGION_ALLOC_FAILED; - } - space->heapNow = (VADDR_T)(UINTPTR)alignAddr; space->heap->range.size = size; ret = (VOID *)(UINTPTR)space->heapNow; diff --git a/kernel/common/los_hilog.c b/kernel/common/los_hilog.c index 612029ba..9a259fee 100644 --- a/kernel/common/los_hilog.c +++ b/kernel/common/los_hilog.c @@ -178,7 +178,7 @@ static ssize_t HiLogRead(FAR struct file *filep, char *buffer, size_t bufLen) } if (bufLen < header.len + sizeof(header)) { - dprintf("buffer too small,bufLen=%d, header.len=%d,%d\n", bufLen, header.len, header.hdrSize, header.nsec); + dprintf("buffer too small,bufLen=%d, header.len=%d,%d\n", bufLen, header.len, header.hdrSize); retval = -ENOMEM; goto out; } @@ -248,13 +248,14 @@ static void HiLogCoverOldLog(size_t bufLen) struct HiLogEntry header; size_t totalSize = bufLen + sizeof(struct HiLogEntry); - while (totalSize + g_hiLogDev.size >= HILOG_BUFFER) { + while (totalSize + g_hiLogDev.size > HILOG_BUFFER) { retval = HiLogReadRingBuffer((unsigned char *)&header, sizeof(header)); if (retval < 0) { break; } - HiLogBufferDec(sizeof(header) + header.len); + HiLogBufferDec(sizeof(header)); + HiLogBufferDec(header.len); } } diff --git a/security/vid/vid.c b/security/vid/vid.c index 0da5be0a..f494e6fd 100644 --- a/security/vid/vid.c +++ b/security/vid/vid.c @@ -138,6 +138,7 @@ static UINT16 GetFreeVid(VOID) } (void)memcpy_s(tmp, mapMaxNum * sizeof(UINT32), idMap->bitMap, (mapMaxNum - 1) * sizeof(UINT32)); + LOS_MemFree(m_aucSysMem0, idMap->bitMap); idMap->bitMap = tmp; idMap->mapCount = mapMaxNum; idMap->bitMap[i] = 1; diff --git a/syscall/time_syscall.c b/syscall/time_syscall.c index af2188dc..3a3502de 100644 --- a/syscall/time_syscall.c +++ b/syscall/time_syscall.c @@ -330,7 +330,7 @@ int SysClockNanoSleep(clockid_t clk, int flags, const struct timespec *req, stru { int ret; struct timespec sreq; - struct timespec srem; + struct timespec srem = {0}; if (!req || LOS_ArchCopyFromUser(&sreq, req, sizeof(struct timespec))) { errno = EFAULT; @@ -354,7 +354,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp) { int ret; struct timespec srqtp; - struct timespec srmtp; + struct timespec srmtp = {0}; if (!rqtp || LOS_ArchCopyFromUser(&srqtp, rqtp, sizeof(struct timespec))) { errno = EFAULT; @@ -477,7 +477,7 @@ int SysClockNanoSleep64(clockid_t clk, int flags, const struct timespec64 *req, { int ret; struct timespec rq; - struct timespec rm; + struct timespec rm = {0}; struct timespec64 sreq; struct timespec64 srem; -- GitLab