Fix memory leak check and interity error check.

Delete redundant judgments.

Close #I3P10Y and #I3QNLT

Change-Id: Ibaf5d4da46f12c291619bb88a41ac18af4612ca1
This commit is contained in:
YOUR_NAME 2021-05-14 14:42:41 +08:00
parent 806ce4eb26
commit 8da10b9439
2 changed files with 2 additions and 10 deletions

View File

@ -94,10 +94,6 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_MemboxInit(VOID *pool, UINT32 poolSize, UINT32
MEMBOX_LOCK(intSave);
boxInfo->uwBlkSize = LOS_MEMBOX_ALLIGNED(blkSize + OS_MEMBOX_NODE_HEAD_SIZE);
if (boxInfo->uwBlkSize == 0) {
MEMBOX_UNLOCK(intSave);
return LOS_NOK;
}
boxInfo->uwBlkNum = (poolSize - sizeof(LOS_MEMBOX_INFO)) / boxInfo->uwBlkSize;
boxInfo->uwBlkCnt = 0;
if (boxInfo->uwBlkNum == 0) {

View File

@ -919,10 +919,6 @@ STATIC INLINE VOID *OsMemAlloc(struct OsMemPoolHead *pool, UINT32 size, UINT32 i
#endif
UINT32 allocSize = OS_MEM_ALIGN(size + OS_MEM_NODE_HEAD_SIZE, OS_MEM_ALIGN_SIZE);
if (allocSize == 0) {
return NULL;
}
#if OS_MEM_EXPAND_ENABLE
retry:
#endif
@ -1531,13 +1527,13 @@ STATIC INLINE VOID OsMemMagicCheckPrint(struct OsMemNodeHead **tmpNode)
STATIC UINT32 OsMemAddrValidCheckPrint(const VOID *pool, struct OsMemFreeNodeHead **tmpNode)
{
if (!OsMemAddrValidCheck(pool, (*tmpNode)->prev)) {
if (((*tmpNode)->prev != NULL) && !OsMemAddrValidCheck(pool, (*tmpNode)->prev)) {
PRINT_ERR("[%s], %d, memory check error!\n"
" freeNode.prev:%#x is out of legal mem range\n",
__FUNCTION__, __LINE__, (*tmpNode)->prev);
return LOS_NOK;
}
if (!OsMemAddrValidCheck(pool, (*tmpNode)->next)) {
if (((*tmpNode)->next != NULL) && !OsMemAddrValidCheck(pool, (*tmpNode)->next)) {
PRINT_ERR("[%s], %d, memory check error!\n"
" freeNode.next:%#x is out of legal mem range\n",
__FUNCTION__, __LINE__, (*tmpNode)->next);