efi_loader: Avoid assigning desc in efi_mem_carve_out()

Rather than assigning desc and then changing two fields, assign all four
fields, for clarity.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2024-12-11 06:54:06 -07:00
parent a298d539ba
commit f6f2ccdf34

View File

@@ -268,9 +268,10 @@ static s64 efi_mem_carve_out(struct efi_mem_list *map,
newmap = calloc(1, sizeof(*newmap));
if (!newmap)
return EFI_CARVE_OUT_OF_RESOURCES;
newmap->desc = map->desc;
newmap->desc.type = map->desc.type;
newmap->desc.physical_start = carve_start;
newmap->desc.num_pages = (map_end - carve_start) >> EFI_PAGE_SHIFT;
newmap->desc.attribute = map->desc.attribute;
/* Insert before current entry (descending address order) */
list_add_tail(&newmap->link, &map->link);