From e8bced62b6be344dbc922d88b1b278e316e1585f Mon Sep 17 00:00:00 2001 From: AKASHI Takahiro Date: Fri, 28 Feb 2020 09:05:04 +0900 Subject: cmd: efidebug: fix a failure of "boot rm" sub-command 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(-) (limited to 'cmd/efidebug.c') diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 21dfd44fcc9..056ebb10832 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -649,7 +649,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) @@ -662,7 +662,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) { -- cgit v1.2.3 From 30efb5dd43fdeb6173c61a55b537fcfba2c45f3f Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 2 Mar 2020 20:13:10 +0100 Subject: cmd: efidebug: correct error message Add the missing line feed at the error message if the variable referred to by 'efidebug boot rm' does not exist. Shorten the format string by using the variable name instead of the number of the boot variable. Signed-off-by: Heinrich Schuchardt --- cmd/efidebug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmd/efidebug.c') diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 056ebb10832..8c3681c37d9 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -667,7 +667,7 @@ static int do_efi_boot_rm(cmd_tbl_t *cmdtp, int flag, ret = EFI_CALL(RT->set_variable(var_name16, &guid, 0, 0, NULL)); if (ret) { - printf("Cannot remove Boot%04X", id); + printf("Cannot remove %ls\n", var_name16); return CMD_RET_FAILURE; } } -- cgit v1.2.3 From a415d61eac26a9108c26ef779f2009dc3062f5d8 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Sat, 14 Mar 2020 08:44:07 +0100 Subject: cmd: map addresses to sysmem in efidebug memmap Addresses in the sandbox's device tree are in the sandbox's virtual address space. If we want to compare memory reservations in the device-tree with the output of 'efidebug memmap', we need to convert back to this address space. Adjust the output of the 'efidebug memmap' command. Signed-off-by: Heinrich Schuchardt --- cmd/efidebug.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cmd/efidebug.c') diff --git a/cmd/efidebug.c b/cmd/efidebug.c index 8c3681c37d9..bb7c13d6a1c 100644 --- a/cmd/efidebug.c +++ b/cmd/efidebug.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -488,9 +489,10 @@ static int do_efi_show_memmap(cmd_tbl_t *cmdtp, int flag, printf("%-16s %.*llx-%.*llx", type, EFI_PHYS_ADDR_WIDTH, - map->physical_start, + (u64)map_to_sysmem((void *)map->physical_start), EFI_PHYS_ADDR_WIDTH, - map->physical_start + map->num_pages * EFI_PAGE_SIZE); + (u64)map_to_sysmem((void *)map->physical_start + + map->num_pages * EFI_PAGE_SIZE)); print_memory_attributes(map->attribute); putc('\n'); -- cgit v1.2.3