Message ID | 8042073f32314e4ca6b88de85f18d345@rwthex-w2-b.rwth-ad.de |
---|---|
State | Accepted |
Commit | 511d0b97ef709d13da4922fb694d55ef9a5ef641 |
Headers | show |
On 30.09.16 02:04, Stefan Brüns wrote: > As soon as a mapping is unlinked from the list, there are no further > references to it, so it should be freed. If it not unlinked, > update the start address and length. > > Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Alexander Graf <agraf@suse.de> Alex
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 0fcfb7a..6d8fae4 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -103,10 +103,13 @@ static int efi_mem_carve_out(struct efi_mem_list *map, if (map_end == carve_end) { /* Full overlap, just remove map */ list_del(&map->link); + free(map); + } else { + map->desc.physical_start = carve_end; + map->desc.num_pages = (map_end - carve_end) + >> EFI_PAGE_SHIFT; } - map_desc->physical_start = carve_end; - map_desc->num_pages = (map_end - carve_end) >> EFI_PAGE_SHIFT; return (carve_end - carve_start) >> EFI_PAGE_SHIFT; }
As soon as a mapping is unlinked from the list, there are no further references to it, so it should be freed. If it not unlinked, update the start address and length. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> --- lib/efi_loader/efi_memory.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)