Commit b6a95172 authored by Stefan Brüns's avatar Stefan Brüns Committed by Alexander Graf
Browse files

efi_loader: Keep memory mapping sorted when splitting an entry



The code assumes sorted mappings in descending address order. When
splitting a mapping, insert the new part next to the current mapping.
Signed-off-by: default avatarStefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: default avatarAlexander Graf <agraf@suse.de>
Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
parent b61d857b
......@@ -135,7 +135,8 @@ static int efi_mem_carve_out(struct efi_mem_list *map,
newmap->desc = map->desc;
newmap->desc.physical_start = carve_start;
newmap->desc.num_pages = (map_end - carve_start) >> EFI_PAGE_SHIFT;
list_add_tail(&newmap->link, &efi_mem);
/* Insert before current entry (descending address order) */
list_add_tail(&newmap->link, &map->link);
/* Shrink the map to [ map_start ... carve_start ] */
map_desc->num_pages = (carve_start - map_start) >> EFI_PAGE_SHIFT;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment