From patchwork Fri Feb 28 00:05:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 236965 List-Id: U-Boot discussion From: takahiro.akashi at linaro.org (AKASHI Takahiro) Date: Fri, 28 Feb 2020 09:05:04 +0900 Subject: [PATCH] cmd: efidebug: fix a failure of "boot rm" sub-command Message-ID: <20200228000504.1814-1-takahiro.akashi@linaro.org> There is a wrong usage of utf8_utf16_strncpy() in "boot rm" command, and then it will end up with a failure of this command due to a wrong value of an interim variable ("var_name16"). Signed-off-by: AKASHI Takahiro Reviewed-by: Heinrich Schuchardt --- cmd/efidebug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 576e95b395dc..3a50dafbbca6 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -641,7 +641,7 @@ static int do_efi_boot_rm(cmd_tbl_t *cmdtp, int flag, int id, i; char *endp; char var_name[9]; - u16 var_name16[9]; + u16 var_name16[9], *p; efi_status_t ret; if (argc == 1) @@ -654,7 +654,8 @@ static int do_efi_boot_rm(cmd_tbl_t *cmdtp, int flag, return CMD_RET_FAILURE; sprintf(var_name, "Boot%04X", id); - utf8_utf16_strncpy((u16 **)&var_name16, var_name, 9); + p = var_name16; + utf8_utf16_strncpy(&p, var_name, 9); ret = EFI_CALL(RT->set_variable(var_name16, &guid, 0, 0, NULL)); if (ret) {