]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Fix NULL dereference I introduced in mincore_page().
authorHugh Dickins <hughd@google.com>
Wed, 3 Aug 2011 00:52:54 +0000 (10:52 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 3 Aug 2011 04:19:26 +0000 (14:19 +1000)
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mincore.c

index 8ad3e90711bdd7153fa9e0a4d180f677b38b502a..733f1829b0dc476136d787744bd9704d4812b1a3 100644 (file)
@@ -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);
        }