diff options
author | Stefan Brüns <stefan.bruens@rwth-aachen.de> | 2016-10-01 23:32:28 +0200 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2016-10-18 09:08:07 +0200 |
commit | b6a951727504d4159467ac98434849f81aaf9ffa (patch) | |
tree | 76b16d38c9396eb1b50d3709154b4d7b7331341e | |
parent | b61d857b2ff3b0b099ef187d7ceebe26ea788578 (diff) | |
download | u-boot-imx-b6a951727504d4159467ac98434849f81aaf9ffa.zip u-boot-imx-b6a951727504d4159467ac98434849f81aaf9ffa.tar.gz u-boot-imx-b6a951727504d4159467ac98434849f81aaf9ffa.tar.bz2 |
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: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r-- | lib/efi_loader/efi_memory.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index d3a2ffd..742bc90 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -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; |