[U-Boot] [PATCH 8/9] efi_loader: rework bootmgr/bootefi using load_image API

AKASHI Takahiro takahiro.akashi at linaro.org
Mon Apr 22 00:44:33 UTC 2019


On Sat, Apr 20, 2019 at 10:07:20AM +0200, Heinrich Schuchardt wrote:
> On 4/19/19 5:22 AM, AKASHI Takahiro wrote:
> >+	/*
> >+	 * FIXME: Who is responsible for
> >+	 *	free(loaded_image_info->load_options);
> >+	 * Once efi_exit() is implemented correctly,
> >+	 * handle itself doesn't exist here.
> >+	 */
> 
> Load option can only be freed when the image is unloaded. For
> applications that will happen when the application call Exit(). For
> drivers there is not guarantee that they will be ever unloaded.

Should we be able to utilize "bootargs" even for drivers?

> In Unload() we should not free load options if they were not allocated
> by us but by an EFI binary.
> 
> In your implementation you have allocated the load options via calloc()
> and not from the EFI pool. So this may allow us to determine whether we
> allocated the load options in the Unload() service.

DO you mean:
    efi_unload_image(...)
        ret = EFI_CALL(efi_pool_free(info->load_options));
        if (ret != EFI_SUCCESS)
        /*
         * Don't care, assuming that load_options have been allocated
         * by application.
         */

It looks fragile.

-Takahiro Akashi

> Best regards
> 
> Heinrich


More information about the U-Boot mailing list