Skip to content

Commit

Permalink
core: mm: zero initialize tee_mm pool structures
Browse files Browse the repository at this point in the history
Zero initialize tee_mm_pool_t instance when such pool is initialized.
This change fixes an issue where phys_mem pool max_allocated
field may contain a fuzzy value because it was not zero-initialized
when allocated by the commit referred below.

Fixes: c596d83 ("core: add phys_mem allocation functions")
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
  • Loading branch information
etienne-lms committed Jan 16, 2025
1 parent b8a9277 commit 64e0975
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions core/mm/tee_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ bool tee_mm_init(tee_mm_pool_t *pool, paddr_t lo, paddr_size_t size,

assert(((uint64_t)size >> shift) < (uint64_t)UINT32_MAX);

pool->lo = lo;
pool->size = size;
pool->shift = shift;
pool->flags = flags;
pool->entry = pcalloc(pool, 1, sizeof(tee_mm_entry_t));
*pool = (tee_mm_pool_t){
.lo = lo,
.size = size,
.shift = shift,
.flags = flags,
};

pool->entry = pcalloc(pool, 1, sizeof(tee_mm_entry_t));
if (pool->entry == NULL)
return false;

Expand Down

0 comments on commit 64e0975

Please sign in to comment.