All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Alexander Graf <agraf@csgraf.de>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	u-boot@lists.denx.de
Subject: Re: [PATCH 1/4] efi_loader: simplify show_efi_boot_opt_data()
Date: Mon, 24 May 2021 16:51:04 +0300	[thread overview]
Message-ID: <YKuvSDr9Koo6k62b@apalos.home> (raw)
In-Reply-To: <20210524095656.161437-2-xypron.glpk@gmx.de>

On Mon, May 24, 2021 at 11:56:53AM +0200, Heinrich Schuchardt wrote:
> To print a UTF-16 string use %ls instead of converting string to UTF-8.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  cmd/efidebug.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/cmd/efidebug.c b/cmd/efidebug.c
> index 0bf7b8856c..9444eca49c 100644
> --- a/cmd/efidebug.c
> +++ b/cmd/efidebug.c
> @@ -1147,8 +1147,6 @@ static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t *size)
>  {
>  	struct efi_device_path *initrd_path = NULL;
>  	struct efi_load_option lo;
> -	char *label, *p;
> -	size_t label_len16, label_len;
>  	u16 *dp_str;
>  	efi_status_t ret;
>  	efi_uintn_t initrd_dp_size;
> @@ -1160,14 +1158,6 @@ static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t *size)
>  		return;
>  	}
> 
> -	label_len16 = u16_strlen(lo.label);
> -	label_len = utf16_utf8_strnlen(lo.label, label_len16);
> -	label = malloc(label_len + 1);
> -	if (!label)
> -		return;
> -	p = label;
> -	utf16_utf8_strncpy(&p, lo.label, label_len16);
> -
>  	printf("%ls:\nattributes: %c%c%c (0x%08x)\n",
>  	       varname16,
>  	       /* ACTIVE */
> @@ -1177,7 +1167,7 @@ static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t *size)
>  	       /* HIDDEN */
>  	       lo.attributes & LOAD_OPTION_HIDDEN ? 'H' : '-',
>  	       lo.attributes);
> -	printf("  label: %s\n", label);
> +	printf("  label: %ls\n", lo.label);
> 
>  	dp_str = efi_dp_str(lo.file_path);
>  	printf("  file_path: %ls\n", dp_str);
> @@ -1194,7 +1184,6 @@ static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t *size)
>  	printf("  data:\n");
>  	print_hex_dump("    ", DUMP_PREFIX_OFFSET, 16, 1,
>  		       lo.optional_data, *size, true);
> -	free(label);
>  }
> 
>  /**
> --
> 2.30.2
> 

Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

  reply	other threads:[~2021-05-24 13:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-24  9:56 [PATCH 0/4] efi_loader: simplify efidebug implementation Heinrich Schuchardt
2021-05-24  9:56 ` [PATCH 1/4] efi_loader: simplify show_efi_boot_opt_data() Heinrich Schuchardt
2021-05-24 13:51   ` Ilias Apalodimas [this message]
2021-05-24  9:56 ` [PATCH 2/4] efi_loader: simplify show_efi_boot_order() Heinrich Schuchardt
2021-05-24 13:52   ` Ilias Apalodimas
2021-05-24  9:56 ` [PATCH 3/4] efi_loader: use efi_create_indexed_name() Heinrich Schuchardt
2021-05-24 13:52   ` Ilias Apalodimas
2021-05-24  9:56 ` [PATCH 4/4] efi_loader: simplify accessing variables Heinrich Schuchardt
2021-05-24 13:55   ` 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=YKuvSDr9Koo6k62b@apalos.home \
    --to=ilias.apalodimas@linaro.org \
    --cc=agraf@csgraf.de \
    --cc=takahiro.akashi@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.