diff options
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r-- | mm/swapfile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index fca04a53cf78..2968b505ca9a 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2301,6 +2301,10 @@ static unsigned long read_swap_header(struct swap_info_struct *p, maxpages = swp_offset(pte_to_swp_entry( swp_entry_to_pte(swp_entry(0, ~0UL)))) + 1; last_page = swap_header->info.last_page; + if (!last_page) { + pr_warn("Empty swap-file\n"); + return 0; + } if (last_page > maxpages) { pr_warn("Truncating oversized swap area, only using %luk out of %luk\n", maxpages << (PAGE_SHIFT - 10), |