Fix loader bug causing too many pages allocation when bootloader is U-Boot
FreeBSD loader expects to have mmsz variable set by bootloader. U-Boot behaviour is that if buffer size is not big enough to keep whole memory map, assign the smallest correct buffer size to sz and return error. In other words U-Boot assumes that nobody will need mmsz value when buffer is not filled with memory map, which is not true, so calculated pages value was too big to allocate. Solution: Simply assign default value to mmsz. Submitted by: Patryk Duda <pdk@semihalf.com> Obtained from: Semihalf Sponsored by: Semihalf Differential Revision: https://reviews.freebsd.org/D12194
This commit is contained in:
parent
eedd5eafbe
commit
cb4226ba86
@ -267,6 +267,13 @@ bi_load_efi_data(struct preloaded_file *kfp)
|
|||||||
|
|
||||||
efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf;
|
efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Assgin size of EFI_MEMORY_DESCRIPTOR to keep compatible with
|
||||||
|
* u-boot which doesn't fill this value when buffer for memory
|
||||||
|
* descriptors is too small (eg. 0 to obtain memory map size)
|
||||||
|
*/
|
||||||
|
mmsz = sizeof(EFI_MEMORY_DESCRIPTOR);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It is possible that the first call to ExitBootServices may change
|
* It is possible that the first call to ExitBootServices may change
|
||||||
* the map key. Fetch a new map key and retry ExitBootServices in that
|
* the map key. Fetch a new map key and retry ExitBootServices in that
|
||||||
|
Loading…
x
Reference in New Issue
Block a user