diff --git a/src/iso_alloc_mem_tags.c b/src/iso_alloc_mem_tags.c index e11ba86..2bb3713 100644 --- a/src/iso_alloc_mem_tags.c +++ b/src/iso_alloc_mem_tags.c @@ -24,7 +24,7 @@ INTERNAL_HIDDEN uint8_t _iso_alloc_get_mem_tag(void *p, iso_alloc_zone_t *zone) } _mtp += (chunk_offset / zone->chunk_size); - ; + return *_mtp; #else return 0; diff --git a/src/iso_alloc_search.c b/src/iso_alloc_search.c index 67c03db..aa42a59 100644 --- a/src/iso_alloc_search.c +++ b/src/iso_alloc_search.c @@ -11,6 +11,12 @@ INTERNAL_HIDDEN void *_iso_alloc_ptr_search(void *n, bool poison) { uint8_t *end = NULL; const size_t zones_used = _root->zones_used; +#if MEMORY_TAGGING || (ARM_MTE == 1) + /* It should be safe to clear these upper bits even + * if the pointer wasn't returned by IsoAlloc. */ + n = (void *) ((uintptr_t) n & TAGGED_PTR_MASK); +#endif + for(int32_t i = 0; i < zones_used; i++) { iso_alloc_zone_t *zone = &_root->zones[i];