kasan: make kasan_addr_to_page static
authorAndrey Konovalov <andreyknvl@google.com>
Mon, 5 Sep 2022 21:05:39 +0000 (23:05 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 3 Oct 2022 21:03:00 +0000 (14:03 -0700)
As kasan_addr_to_page() is only used in report.c, rename it to
addr_to_page() and make it static.

Link: https://lkml.kernel.org/r/66c1267200fe0c16e2ac8847a9315fda041918cb.1662411799.git.andreyknvl@google.com
Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Evgenii Stepanov <eugenis@google.com>
Cc: Peter Collingbourne <pcc@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/kasan/kasan.h
mm/kasan/report.c

index cca49ab..4fddfdb 100644 (file)
@@ -291,7 +291,6 @@ bool kasan_report(unsigned long addr, size_t size,
                bool is_write, unsigned long ip);
 void kasan_report_invalid_free(void *object, unsigned long ip, enum kasan_report_type type);
 
-struct page *kasan_addr_to_page(const void *addr);
 struct slab *kasan_addr_to_slab(const void *addr);
 
 #ifdef CONFIG_KASAN_GENERIC
index cd31b3b..ac526c1 100644 (file)
@@ -206,7 +206,7 @@ static void print_track(struct kasan_track *track, const char *prefix)
                pr_err("(stack is not available)\n");
 }
 
-struct page *kasan_addr_to_page(const void *addr)
+static inline struct page *addr_to_page(const void *addr)
 {
        if (virt_addr_valid(addr))
                return virt_to_head_page(addr);
@@ -289,7 +289,7 @@ static inline bool init_task_stack_addr(const void *addr)
 
 static void print_address_description(void *addr, u8 tag)
 {
-       struct page *page = kasan_addr_to_page(addr);
+       struct page *page = addr_to_page(addr);
        struct slab *slab = kasan_addr_to_slab(addr);
 
        dump_stack_lvl(KERN_ERR);