From: Andrey Konovalov <andreyknvl@xxxxxxxxxx> Move the definition of kasan_addr_to_slab() to the common KASAN code, as this function is not only used by the reporting code. Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx> --- mm/kasan/common.c | 7 +++++++ mm/kasan/report.c | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/kasan/common.c b/mm/kasan/common.c index 519fd0b3040b..5d5b4cfae503 100644 --- a/mm/kasan/common.c +++ b/mm/kasan/common.c @@ -30,6 +30,13 @@ #include "kasan.h" #include "../slab.h" +struct slab *kasan_addr_to_slab(const void *addr) +{ + if ((addr >= (void *)PAGE_OFFSET) && (addr < high_memory)) + return virt_to_slab(addr); + return NULL; +} + depot_stack_handle_t kasan_save_stack(gfp_t flags, bool can_alloc) { unsigned long entries[KASAN_STACK_DEPTH]; diff --git a/mm/kasan/report.c b/mm/kasan/report.c index 1dd6fc8a678f..ed8234516bab 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -207,13 +207,6 @@ struct page *kasan_addr_to_page(const void *addr) return NULL; } -struct slab *kasan_addr_to_slab(const void *addr) -{ - if ((addr >= (void *)PAGE_OFFSET) && (addr < high_memory)) - return virt_to_slab(addr); - return NULL; -} - static void describe_object_addr(struct kmem_cache *cache, void *object, const void *addr) { -- 2.25.1