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