Your patch makes sens but the commit message is wrong. In general we will be leaking memory for short time. Not big deal here but worth fixing. The memory will not be freed twice as you say in the commit message. May I ask you to fix the commit message?
On Tue, Apr 23, 2024 at 09:04:34AM +0800, Zhou Jianfeng wrote: > From: Zhou JianFeng <jianfeng.z...@intel.com> > > Memory freed by function grub_efi_free_pages() with wrong pages will > not be removed from list efi_allocated_memory by function > grub_efi_drop_alloc(), it will be freed again by function At least "again" should be dropped from here. Though in general this commit message does not parse well and should be rephrased. > grub_efi_memory_fini() which is called by function > grub_machine_fini()/grub_exit() when exit grub. > Freeing memory twice may lead to unpredictable result. > > Cc: daniel.ki...@oracle.com > Cc: alexander.burmas...@oracle.com > Cc: phco...@gmail.com > Signed-off-by: Zhou JianFeng <jianfeng.z...@intel.com> > --- > grub-core/kern/efi/mm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/grub-core/kern/efi/mm.c b/grub-core/kern/efi/mm.c > index 6a6fba891..49daa976f 100644 > --- a/grub-core/kern/efi/mm.c > +++ b/grub-core/kern/efi/mm.c > @@ -643,7 +643,7 @@ grub_efi_mm_add_regions (grub_size_t required_bytes, > unsigned int flags) > > /* Release the memory maps. */ > grub_efi_free_pages ((grub_addr_t) memory_map, > - 2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE)); > + 2 * BYTES_TO_PAGES (map_size)); > > return GRUB_ERR_NONE; > } Daniel _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel