diff mbox series

env: efi: fix a wrong address dereference

Message ID 20210703142522.31364-1-trini@konsulko.com
State Accepted
Commit f1eb346e336fee7c14ed289dc854da4556c29a44
Headers show
Series env: efi: fix a wrong address dereference | expand

Commit Message

Tom Rini July 3, 2021, 2:25 p.m. UTC
From: AKASHI Takahiro <takahiro.akashi@linaro.org>


Probably, a pointer to a variable in an inner block should not
be exposed to an outer block.

Fixes: c70f44817d46 ("efi_loader: simplify 'printenv -e'")
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

[trini: Don't make guid const now]
Signed-off-by: Tom Rini <trini@konsulko.com>

---
 cmd/nvedit_efi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.17.1

Comments

Tom Rini July 6, 2021, 12:59 a.m. UTC | #1
On Sat, Jul 03, 2021 at 10:25:22AM -0400, Tom Rini wrote:

> From: AKASHI Takahiro <takahiro.akashi@linaro.org>

> 

> Probably, a pointer to a variable in an inner block should not

> be exposed to an outer block.

> 

> Fixes: c70f44817d46 ("efi_loader: simplify 'printenv -e'")

> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

> [trini: Don't make guid const now]

> Signed-off-by: Tom Rini <trini@konsulko.com>


Applied to u-boot/master, thanks!

-- 
Tom
diff mbox series

Patch

diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c
index 094c0e809870..d5e93827e45c 100644
--- a/cmd/nvedit_efi.c
+++ b/cmd/nvedit_efi.c
@@ -241,6 +241,7 @@  int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc,
 		     char *const argv[])
 {
 	const efi_guid_t *guid_p = NULL;
+	efi_guid_t guid;
 	bool verbose = true;
 	efi_status_t ret;
 
@@ -254,8 +255,6 @@  int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc,
 
 	for (argc--, argv++; argc > 0 && argv[0][0] == '-'; argc--, argv++) {
 		if (!strcmp(argv[0], "-guid")) {
-			efi_guid_t guid;
-
 			if (argc == 1)
 				return CMD_RET_USAGE;
 			argc--;