mm/sw_tags: Add API for register
Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
parent
1da8cf8104
commit
430820e7ec
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user