|
@@ -2961,6 +2961,10 @@ static unsigned long read_swap_header(struct swap_info_struct *p,
|
|
maxpages = swp_offset(pte_to_swp_entry(
|
|
maxpages = swp_offset(pte_to_swp_entry(
|
|
swp_entry_to_pte(swp_entry(0, ~0UL)))) + 1;
|
|
swp_entry_to_pte(swp_entry(0, ~0UL)))) + 1;
|
|
last_page = swap_header->info.last_page;
|
|
last_page = swap_header->info.last_page;
|
|
|
|
+ if (!last_page) {
|
|
|
|
+ pr_warn("Empty swap-file\n");
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
if (last_page > maxpages) {
|
|
if (last_page > maxpages) {
|
|
pr_warn("Truncating oversized swap area, only using %luk out of %luk\n",
|
|
pr_warn("Truncating oversized swap area, only using %luk out of %luk\n",
|
|
maxpages << (PAGE_SHIFT - 10),
|
|
maxpages << (PAGE_SHIFT - 10),
|