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 731964b63c624175bbaf9c2611a78f69f6babf73 Author: wangmingrong1 <[email protected]> AuthorDate: Mon Nov 2 18:59:58 2026 +0800 mm/kasan: compare the heap bounds with the tag cleared A heap can be initialized on a block taken from another heap, in which case mm_heapstart[] and mm_heapend[] hold addresses that still carry a KASAN tag. mm_heapmember() clears the tag on the address it is asked about but compared it with the tagged bounds, so a valid address was reported as outside the heap. Clear the tag on both bounds as well. Signed-off-by: wangmingrong1 <[email protected]> --- mm/mm_heap/mm_heapmember.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/mm_heap/mm_heapmember.c b/mm/mm_heap/mm_heapmember.c index 3de02d9bd8e..1b03a129796 100644 --- a/mm/mm_heap/mm_heapmember.c +++ b/mm/mm_heap/mm_heapmember.c @@ -67,8 +67,8 @@ bool mm_heapmember(FAR struct mm_heap_s *heap, FAR void *mem) for (i = 0; i < heap->mm_nregions; i++) { - if (mem > (FAR void *)heap->mm_heapstart[i] && - mem < (FAR void *)heap->mm_heapend[i]) + if (mem > kasan_clear_tag((FAR void *)heap->mm_heapstart[i]) && + mem < kasan_clear_tag((FAR void *)heap->mm_heapend[i])) { return true; } @@ -83,8 +83,8 @@ bool mm_heapmember(FAR struct mm_heap_s *heap, FAR void *mem) * two guard nodes. */ - if (mem > (FAR void *)heap->mm_heapstart[0] && - mem < (FAR void *)heap->mm_heapend[0]) + if (mem > kasan_clear_tag((FAR void *)heap->mm_heapstart[0]) && + mem < kasan_clear_tag((FAR void *)heap->mm_heapend[0])) { return true; }
