[U-Boot] [RFC v2 03/11] efi_loader: device_path: handle special case of loading

Heinrich Schuchardt xypron.glpk at gmx.de
Wed Mar 27 06:17:02 UTC 2019


On 3/27/19 5:40 AM, AKASHI Takahiro wrote:
> This is a preparatory patch.
>
> efi_dp_split_file_path() is used to create device_path and file_path
> from file_path for efi_setup_loaded_image().
> In a special case, however, of HARDWARE_DEVICE/MEMORY, it doesn't
> work expectedly since this path doesn't contain any FILE_PATH sub-type.

As already mentioned in a comment to patch 1/11 I would prefer that we
pass the original device path to efi_setup_loaded_image() instead of
recombining device path and file path there again.

This would avoid special treatment here with possible side effects in
efi_fs_from_path().

Best regards

Heinrich

>
> This patch makes a workaround.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
> ---
>  lib/efi_loader/efi_device_path.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
> index 53b40c8c3c2d..e283fad767ed 100644
> --- a/lib/efi_loader/efi_device_path.c
> +++ b/lib/efi_loader/efi_device_path.c
> @@ -933,6 +933,14 @@ efi_status_t efi_dp_split_file_path(struct efi_device_path *full_path,
>  	dp = efi_dp_dup(full_path);
>  	if (!dp)
>  		return EFI_OUT_OF_RESOURCES;
> +
> +	if (EFI_DP_TYPE(dp, HARDWARE_DEVICE, MEMORY)) {
> +		/* no FILE_PATH */
> +		*device_path = dp;
> +
> +		return EFI_SUCCESS;
> +	}
> +
>  	p = dp;
>  	while (!EFI_DP_TYPE(p, MEDIA_DEVICE, FILE_PATH)) {
>  		p = efi_dp_next(p);
>






More information about the U-Boot mailing list