diff mbox series

[RFC,01/14] cmd: efi: avoid unitialized read

Message ID 20241124-b4-efistub-arm64-v1-1-3e33f0340071@linaro.org
State New
Headers show
Series efi: implement EFISTUB support for ARM64 and Qualcomm | expand

Commit Message

Caleb Connolly Nov. 24, 2024, 8:26 p.m. UTC
The key variable might be unitialised when accessed for the printf().
Zero initialise it to avoid this.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
 cmd/efi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ilias Apalodimas Nov. 25, 2024, 11:02 a.m. UTC | #1
On Sun, 24 Nov 2024 at 22:27, Caleb Connolly <caleb.connolly@linaro.org> wrote:
>
> The key variable might be unitialised when accessed for the printf().
> Zero initialise it to avoid this.
>
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
>  cmd/efi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cmd/efi.c b/cmd/efi.c
> index 687ccb520428..1fb67a83aae5 100644
> --- a/cmd/efi.c
> +++ b/cmd/efi.c
> @@ -220,9 +220,9 @@ static void efi_print_mem_table(struct efi_mem_desc *desc, int desc_size,
>  static int do_efi_mem(struct cmd_tbl *cmdtp, int flag, int argc,
>                       char *const argv[])
>  {
>         struct efi_mem_desc *orig, *desc;
> -       uint version, key;
> +       uint version, key = 0;
>         int desc_size;
>         int size, ret;
>         bool skip_bs;
>
>
> --
> 2.47.0
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
diff mbox series

Patch

diff --git a/cmd/efi.c b/cmd/efi.c
index 687ccb520428..1fb67a83aae5 100644
--- a/cmd/efi.c
+++ b/cmd/efi.c
@@ -220,9 +220,9 @@  static void efi_print_mem_table(struct efi_mem_desc *desc, int desc_size,
 static int do_efi_mem(struct cmd_tbl *cmdtp, int flag, int argc,
 		      char *const argv[])
 {
 	struct efi_mem_desc *orig, *desc;
-	uint version, key;
+	uint version, key = 0;
 	int desc_size;
 	int size, ret;
 	bool skip_bs;