aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Konovalov <[email protected]>2022-09-05 23:05:37 +0200
committerAndrew Morton <[email protected]>2022-10-03 14:03:00 -0700
commit2c9fb1fd1dd0b17cf8f48935a9c3ecea066f10e8 (patch)
tree9a8b7ed400de2c7dca709af5ceec08b198f8fb15
parent9ef08d265e3f02b3266a46f684de5741724bd7f8 (diff)
kasan: use virt_addr_valid in kasan_addr_to_page/slab
Instead of open-coding the validity checks for addr in kasan_addr_to_page/slab(), use the virt_addr_valid() helper. Link: https://lkml.kernel.org/r/c22a4850d74d7430f8a6c08216fd55c2860a2b9e.1662411799.git.andreyknvl@google.com Signed-off-by: Andrey Konovalov <[email protected]> Reviewed-by: Marco Elver <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Andrey Ryabinin <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Evgenii Stepanov <[email protected]> Cc: Peter Collingbourne <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r--mm/kasan/report.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index 83f420a28c0b..570f9419b90c 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -208,14 +208,14 @@ static void print_track(struct kasan_track *track, const char *prefix)
struct page *kasan_addr_to_page(const void *addr)
{
- if ((addr >= (void *)PAGE_OFFSET) && (addr < high_memory))
+ if (virt_addr_valid(addr))
return virt_to_head_page(addr);
return NULL;
}
struct slab *kasan_addr_to_slab(const void *addr)
{
- if ((addr >= (void *)PAGE_OFFSET) && (addr < high_memory))
+ if (virt_addr_valid(addr))
return virt_to_slab(addr);
return NULL;
}