efi: really mark memory of unknown type as reserved

9be4c45dbe added switch case between
fall through cases, causing all memory regions of unknown type to be
marked as available.

Move default case into its own block and add explicit FALLTHROUGH
annotation.

Reported by Elliott, Robert (Persistent Memory) <elliott@hpe.com>
This commit is contained in:
Andrei Borzenkov 2015-11-26 19:50:42 +03:00
parent f9d1b4422e
commit 3d2c8048da

View file

@ -73,6 +73,7 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
GRUB_MEMORY_AVAILABLE, hook_data);
break;
}
/* FALLTHROUGH */
case GRUB_EFI_RUNTIME_SERVICES_CODE:
hook (desc->physical_start, desc->num_pages * 4096,
GRUB_MEMORY_CODE, hook_data);
@ -83,10 +84,6 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
GRUB_MEMORY_BADRAM, hook_data);
break;
default:
grub_printf ("Unknown memory type %d, considering reserved\n",
desc->type);
case GRUB_EFI_BOOT_SERVICES_DATA:
if (!avoid_efi_boot_services)
{
@ -94,6 +91,7 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
GRUB_MEMORY_AVAILABLE, hook_data);
break;
}
/* FALLTHROUGH */
case GRUB_EFI_RESERVED_MEMORY_TYPE:
case GRUB_EFI_RUNTIME_SERVICES_DATA:
case GRUB_EFI_MEMORY_MAPPED_IO:
@ -119,6 +117,13 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
hook (desc->physical_start, desc->num_pages * 4096,
GRUB_MEMORY_NVS, hook_data);
break;
default:
grub_printf ("Unknown memory type %d, considering reserved\n",
desc->type);
hook (desc->physical_start, desc->num_pages * 4096,
GRUB_MEMORY_RESERVED, hook_data);
break;
}
}