diff --git a/mm/kasan/sw_tags.c b/mm/kasan/sw_tags.c index 94ac57aa12..572d7964e9 100644 --- a/mm/kasan/sw_tags.c +++ b/mm/kasan/sw_tags.c @@ -185,3 +185,31 @@ void kasan_register(FAR void *addr, FAR size_t *size) *size -= KASAN_REGION_SIZE(*size); } +void kasan_unregister(FAR void *addr) +{ + FAR struct kasan_region_s *prev = NULL; + FAR struct kasan_region_s *region; + irqstate_t flags; + + flags = spin_lock_irqsave(&g_lock); + for (region = g_region; region != NULL; region = region->next) + { + if (region->begin == (uintptr_t)addr) + { + if (region == g_region) + { + g_region = region->next; + } + else + { + prev->next = region->next; + } + + break; + } + + prev = region; + } + + spin_unlock_irqrestore(&g_lock, flags); +}