This is an automated email from the ASF dual-hosted git repository. GUIDINGLI pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit ee89188a4ed11419698625ce1b3a7e21fb4f6d45 Author: wangmingrong1 <[email protected]> AuthorDate: Mon Nov 2 18:59:58 2026 +0800 mm/mm_heap: align the region size down before KASAN registration kasan_register() carves the shadow area off the end of the range it is given, so an unaligned tail there leaves the end of the region outside both the heap and the shadow bookkeeping. Round the size down to MM_ALIGN before registering; mm_addregion() already aligns the heap end the same way afterwards. Signed-off-by: wangmingrong1 <[email protected]> --- mm/mm_heap/mm_initialize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mm_heap/mm_initialize.c b/mm/mm_heap/mm_initialize.c index b9228410b5f..b1bc2246cdc 100644 --- a/mm/mm_heap/mm_initialize.c +++ b/mm/mm_heap/mm_initialize.c @@ -155,7 +155,7 @@ void mm_addregion(FAR struct mm_heap_s *heap, FAR void *heapstart, heapbase = MM_ALIGN_UP((uintptr_t)heapstart + 2 * MM_SIZEOF_ALLOCNODE) - 2 * MM_SIZEOF_ALLOCNODE; - heapsize = heapsize - (heapbase - (uintptr_t)heapstart); + heapsize = MM_ALIGN_DOWN(heapsize - (heapbase - (uintptr_t)heapstart)); /* Register KASan for access rights check. We need to register after * address alignment.
