|
|
f731ee |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
f731ee |
From: Andrei Borzenkov <arvidjaar@gmail.com>
|
|
|
f731ee |
Date: Thu, 26 Nov 2015 19:50:42 +0300
|
|
|
f731ee |
Subject: [PATCH] efi: really mark memory of unknown type as reserved
|
|
|
f731ee |
|
|
|
f731ee |
9be4c45dbe3c877d1f4856e99ee15133c6cd2261 added switch case between
|
|
|
f731ee |
fall through cases, causing all memory regions of unknown type to be
|
|
|
f731ee |
marked as available.
|
|
|
f731ee |
|
|
|
f731ee |
Move default case into its own block and add explicit FALLTHROUGH
|
|
|
f731ee |
annotation.
|
|
|
f731ee |
|
|
|
f731ee |
Reported by Elliott, Robert (Persistent Memory) <elliott@hpe.com>
|
|
|
f731ee |
|
|
|
f731ee |
(cherry picked from commit 3d2c8048da7db334fd6d57b27304ac765fd4cd67)
|
|
|
f731ee |
|
|
|
f731ee |
Resolves: rhbz#1288608
|
|
|
f731ee |
---
|
|
|
f731ee |
grub-core/mmap/efi/mmap.c | 13 +++++++++----
|
|
|
f731ee |
1 file changed, 9 insertions(+), 4 deletions(-)
|
|
|
f731ee |
|
|
|
f731ee |
diff --git a/grub-core/mmap/efi/mmap.c b/grub-core/mmap/efi/mmap.c
|
|
|
f731ee |
index a77efe81d0c..900a4d6598c 100644
|
|
|
f731ee |
--- a/grub-core/mmap/efi/mmap.c
|
|
|
f731ee |
+++ b/grub-core/mmap/efi/mmap.c
|
|
|
f731ee |
@@ -73,6 +73,7 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
|
|
|
f731ee |
GRUB_MEMORY_AVAILABLE, hook_data);
|
|
|
f731ee |
break;
|
|
|
f731ee |
}
|
|
|
f731ee |
+ /* FALLTHROUGH */
|
|
|
f731ee |
case GRUB_EFI_RUNTIME_SERVICES_CODE:
|
|
|
f731ee |
hook (desc->physical_start, desc->num_pages * 4096,
|
|
|
f731ee |
GRUB_MEMORY_CODE, hook_data);
|
|
|
f731ee |
@@ -83,10 +84,6 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
|
|
|
f731ee |
GRUB_MEMORY_BADRAM, hook_data);
|
|
|
f731ee |
break;
|
|
|
f731ee |
|
|
|
f731ee |
- default:
|
|
|
f731ee |
- grub_printf ("Unknown memory type %d, considering reserved\n",
|
|
|
f731ee |
- desc->type);
|
|
|
f731ee |
-
|
|
|
f731ee |
case GRUB_EFI_BOOT_SERVICES_DATA:
|
|
|
f731ee |
if (!avoid_efi_boot_services)
|
|
|
f731ee |
{
|
|
|
f731ee |
@@ -94,6 +91,7 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
|
|
|
f731ee |
GRUB_MEMORY_AVAILABLE, hook_data);
|
|
|
f731ee |
break;
|
|
|
f731ee |
}
|
|
|
f731ee |
+ /* FALLTHROUGH */
|
|
|
f731ee |
case GRUB_EFI_RESERVED_MEMORY_TYPE:
|
|
|
f731ee |
case GRUB_EFI_RUNTIME_SERVICES_DATA:
|
|
|
f731ee |
case GRUB_EFI_MEMORY_MAPPED_IO:
|
|
|
f731ee |
@@ -119,6 +117,13 @@ grub_efi_mmap_iterate (grub_memory_hook_t hook, void *hook_data,
|
|
|
f731ee |
hook (desc->physical_start, desc->num_pages * 4096,
|
|
|
f731ee |
GRUB_MEMORY_NVS, hook_data);
|
|
|
f731ee |
break;
|
|
|
f731ee |
+
|
|
|
f731ee |
+ default:
|
|
|
f731ee |
+ grub_printf ("Unknown memory type %d, considering reserved\n",
|
|
|
f731ee |
+ desc->type);
|
|
|
f731ee |
+ hook (desc->physical_start, desc->num_pages * 4096,
|
|
|
f731ee |
+ GRUB_MEMORY_RESERVED, hook_data);
|
|
|
f731ee |
+ break;
|
|
|
f731ee |
}
|
|
|
f731ee |
}
|
|
|
f731ee |
|