Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions loader-proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ try_load_from_lf2(EFI_DEVICE_PATH *dp, buffer_properties_t *bprop)
static void
free_pages_alloc_image(SHIM_LOADED_IMAGE *image)
{
char *buffer;

if (!image || !image->alloc_address || !image->alloc_pages)
return;

Expand All @@ -196,9 +194,8 @@ free_pages_alloc_image(SHIM_LOADED_IMAGE *image)
* are set on a loaded image, this will cause a page fault when it
* is freed. Ensure W+ X- are set instead before freeing. */

buffer = (void *)ALIGN_VALUE((unsigned long)image->alloc_address, image->alloc_alignment);
update_mem_attrs((uintptr_t)buffer, image->alloc_pages * PAGE_SIZE, MEM_ATTR_R|MEM_ATTR_W,
MEM_ATTR_X);
update_mem_attrs((uintptr_t)image->alloc_address,
image->alloc_pages * PAGE_SIZE, MEM_ATTR_R|MEM_ATTR_W, MEM_ATTR_X);

BS->FreePages(image->alloc_address, image->alloc_pages);
image->alloc_address = 0;
Expand Down
2 changes: 1 addition & 1 deletion pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ handle_image (void *data, unsigned int datasize,
dprint(L"Loading 0x%llx bytes at 0x%llx\n",
(unsigned long long)context.ImageSize,
(unsigned long long)(uintptr_t)buffer);
update_mem_attrs((uintptr_t)buffer, alloc_size, MEM_ATTR_R|MEM_ATTR_W,
update_mem_attrs((uintptr_t)buffer, context.ImageSize, MEM_ATTR_R|MEM_ATTR_W,
MEM_ATTR_X);

CopyMem(buffer, data, context.SizeOfHeaders);
Expand Down
Loading