public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: u-boot@lists.denx.de
Subject: [PATCH 1/2] efi_loader: multi part device paths to text
Date: Fri, 19 Feb 2021 12:13:24 +0200	[thread overview]
Message-ID: <YC+PRLifxDwzwHhB@enceladus> (raw)
In-Reply-To: <20210218173044.127456-2-xypron.glpk@gmx.de>

Hi Heinrich

On Thu, Feb 18, 2021 at 06:30:43PM +0100, Heinrich Schuchardt wrote:
> Our current implementation of
> EFI_DEVICE_PATH_TO_TEXT_PROTOCOL.ConvertDevicePathToText() truncates multi
> part device paths after the first part. We should convert all parts.
> 
> Render device path instance ends as commas. This is not explicitly
> described in the UEFI spec but mimics what EDK II does.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  lib/efi_loader/efi_device_path_to_text.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c
> index 1aaa9f94fa..81b8ac23ba 100644
> --- a/lib/efi_loader/efi_device_path_to_text.c
> +++ b/lib/efi_loader/efi_device_path_to_text.c
> @@ -369,11 +369,18 @@ static uint16_t EFIAPI *efi_convert_device_path_to_text(
> 
>  	if (!device_path)
>  		goto out;
> -	while (device_path &&
> -	       str + MAX_NODE_LEN < buffer + MAX_PATH_LEN) {
> -		*str++ = '/';
> -		str = efi_convert_single_device_node_to_text(str, device_path);
> -		device_path = efi_dp_next(device_path);
> +	while (device_path && str + MAX_NODE_LEN < buffer + MAX_PATH_LEN) {
> +		if (device_path->type == DEVICE_PATH_TYPE_END) {
> +			if (device_path->sub_type !=
> +			    DEVICE_PATH_SUB_TYPE_INSTANCE_END)

maybe it's better to check explicitly for '== DEVICE_PATH_SUB_TYPE_END'?

> +				break;
> +			*str++ = ',';
> +		} else {
> +			*str++ = '/';
> +			str = efi_convert_single_device_node_to_text(
> +							str, device_path);
> +		}
> +		*(u8 **)&device_path += device_path->length;
>  	}
> 
>  	text = efi_str_to_u16(buffer);
> --
> 2.30.0
> 

Cheers
/Ilias

  reply	other threads:[~2021-02-19 10:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 17:30 [PATCH 0/2] efi_loader: multi part device paths to text Heinrich Schuchardt
2021-02-18 17:30 ` [PATCH 1/2] " Heinrich Schuchardt
2021-02-19 10:13   ` Ilias Apalodimas [this message]
2021-02-19 11:45     ` Heinrich Schuchardt
2021-02-19 12:02       ` Ilias Apalodimas
2021-02-18 17:30 ` [PATCH 2/2] efi_selftest: multi part device path " Heinrich Schuchardt
2021-02-19 10:15   ` Ilias Apalodimas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YC+PRLifxDwzwHhB@enceladus \
    --to=ilias.apalodimas@linaro.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox