diff options
| author | seteiro <[email protected]> | 2026-11-10 10:03:38 +0900 |
|---|---|---|
| committer | Rbb666 <[email protected]> | 2026-11-12 10:14:02 +0800 |
| commit | 10e6d0f8637b7dcb8647c0d165c2d4f5cf79d7f8 (patch) | |
| tree | f12e97d541530b5d8466b1f36c1577c05a8a0408 /components/rust | |
| parent | 2e2ec0151de58781d8dbc2df4abe8159903efab6 (diff) | |
[kernel][mem] fix false MEM_POOL assert when freeing block before heap_end
rt_smem_free() validated mem->next by requiring the next item's pool
pointer to be the current pool. For the last block, mem->next points at
the heap_end sentinel. Older/vendor small-mem pools may keep only the
used bit in the sentinel's pool_ptr, so MEM_POOL(heap_end) is NULL and
the assertion fires although the heap is consistent.
Accept mem->next == heap_end offset explicitly and keep the same-pool
check for every other next item. Changing the check to mem->prev is not
equivalent: prev describes the previous block (0 for the first block), so
it would not validate the next pointer.
Reproduced on the host with the real mem.c by making the sentinel carry
only the used bit: the old assertion aborts, the new one passes. Added a
core.mem utest that allocates the last block, simulates that sentinel
state, frees it, and verifies the heap is fully merged. Normal middle,
first and last frees/merges remain covered by the existing test.
No functional change for well-formed heaps.
Diffstat (limited to 'components/rust')
0 files changed, 0 insertions, 0 deletions
