34 Star 152 Fork 62

OpenHarmony / kernel_liteos_m

los_memory.c 变量都未进行初始化,将来出了问题不好定位

任务
待办的
陈国  Opened this issue

LITE_OS_SEC_TEXT_INIT UINT32 OsMemSystemInit()
{
UINT32 ret; //here
UINT32 memSize; //here
m_aucSysMem0 = (UINT8 *)(UINTPTR)(((UINT32)(UINTPTR)m_aucSysMem0 + (OS_MEM_NODE_ALIGN_SIZE - 1)) &
~(OS_MEM_NODE_ALIGN_SIZE - 1));
memSize = ((UINT32)g_sysMemAddrEnd) - OS_SYS_NOCACHEMEM_SIZE - (UINT32)(UINTPTR)m_aucSysMem0;
ret = LOS_MemInit(m_aucSysMem0, memSize);
PRINT_INFO("LiteOS heap memory address:0x%x,size:0x%x\n", m_aucSysMem0, memSize);
return ret;
}

Attachments
8046261 mgy917 1599794627 total 5 participants

Comments (4)

8046261 mgy917 1599794627
MGY917 2020-09-11 11:09

这里可以不进行初始化,使用前有赋值操作即可。否则会冗余初始化。

+1 3
fishincat 2020-09-11 11:47

提交代码issue的时候,格式能不能搞好啊 :sweat:

weepingtown 2020-09-11 12:49

华为的编程规范不允许重复初始化,这个你放心,如果后面修改导致变量未初始化而被使用,很容易在白盒检查时拦截到

oyouth 2020-09-13 19:38

编译器魔法

Sign in to comment

Assignees
Labels
Not set
Projects
Milestones
Branches
Planed to start
Not set
Planed to end
Not set
Top level
Priority
C
1
https://git.oschina.net/openharmony/kernel_liteos_m.git
git@git.oschina.net:openharmony/kernel_liteos_m.git
openharmony
kernel_liteos_m
kernel_liteos_m

Search