Blame SOURCES/0191-efi-really-mark-memory-of-unknown-type-as-reserved.patch

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