From b1cd1ebbe1bdc1bc4025949e3e8b0f76d99c953f Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Tue, 26 Jul 2011 20:14:55 +1000 Subject: [PATCH] Fix NULL dereference I introduced in mincore_page(). Signed-off-by: Hugh Dickins Cc: Rik van Riel Signed-off-by: Andrew Morton --- mm/mincore.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/mincore.c b/mm/mincore.c index 8ad3e90711bd..733f1829b0dc 100644 --- a/mm/mincore.c +++ b/mm/mincore.c @@ -71,13 +71,13 @@ static unsigned char mincore_page(struct address_space *mapping, pgoff_t pgoff) * tmpfs's .fault). So swapped out tmpfs mappings are tested here. */ page = find_get_page(mapping, pgoff); - if (page) { #ifdef CONFIG_SWAP - if (radix_tree_exceptional_entry(page)) { - swp_entry_t swap = radix_to_swp_entry(page); - page = find_get_page(&swapper_space, swap.val); - } + if (radix_tree_exceptional_entry(page)) { + swp_entry_t swap = radix_to_swp_entry(page); + page = find_get_page(&swapper_space, swap.val); + } #endif + if (page) { present = PageUptodate(page); page_cache_release(page); } -- 2.39.2