menu: Change how max size of saved rewound memmap is calculated
diff --git a/common/menu.c b/common/menu.c
index c8a069c1..d67b7edb 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -723,10 +723,8 @@ noreturn void _menu(bool first_run) {
rewound_s2_data = ext_mem_alloc(s2_data_size);
rewound_bss = ext_mem_alloc(bss_size);
#endif
- rewound_memmap = ext_mem_alloc(MEMMAP_MAX * sizeof(struct memmap_entry));
- if (memmap_entries > MEMMAP_MAX) {
- panic(false, "menu: Too many memmap entries");
- }
+ /* addition due to allocation potentially adding new memory map entries */
+ rewound_memmap = ext_mem_alloc((memmap_entries + 16) * sizeof(struct memmap_entry));
memcpy(rewound_memmap, memmap, memmap_entries * sizeof(struct memmap_entry));
rewound_memmap_entries = memmap_entries;
memcpy(rewound_data, data_begin, data_size);
