Re: [mm] 2037ab69a5: BUG:KASAN:null-ptr-deref_in_t

From: Matthew Wilcox
Date: Mon Sep 14 2020 - 07:33:05 EST


On Mon, Sep 14, 2020 at 04:55:45PM +0800, kernel test robot wrote:
> Greeting,
>
> FYI, we noticed the following commit (built with gcc-9):
>
> commit: 2037ab69a5cd8afe58347135010f6160ea368dd0 ("mm: Convert find_get_entry to return the head page")

Thank you!

diff --git a/mm/swap_state.c b/mm/swap_state.c
index c2fb62f660a5..a22c2430e80c 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -427,6 +427,8 @@ struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index)
struct swap_info_struct *si;
struct page *page = find_get_entry(mapping, index);

+ if (!page)
+ return page;
if (!xa_is_value(page))
return find_subpage(page, index);
if (!shmem_mapping(mapping))