]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
util/grub-protect: Correct uninit "err" variable
authorAndrew Hamilton <adhamilt@gmail.com>
Wed, 18 Jun 2025 01:58:26 +0000 (20:58 -0500)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 26 Jun 2025 15:19:25 +0000 (17:19 +0200)
In function protect_tpm2_export_tpm2key(), the "err" variable
is uninitialized in the normal (error free) path, so ensure this
defaults to GRUB_ERR_NONE.

This causes the GRUB build to fail with clang (observed with clang-14).

Fixes: 5934bf51c (util/grub-protect: Support NV index mode)
Signed-off-by: Andrew Hamilton <adhamilt@gmail.com>
Reviewed-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
util/grub-protect.c

index d53c2572d39a22d5e5303a1ef3ecbd660369b200..868eb76b9b5080da174317edad342fc7dba0cf82 100644 (file)
@@ -703,7 +703,7 @@ protect_tpm2_export_tpm2key (const protect_args_t *args, tpm2_sealed_key_t *seal
   struct grub_tpm2_buffer priv_buf;
   int i;
   int ret;
-  grub_err_t err;
+  grub_err_t err = GRUB_ERR_NONE;
 
   if (der_buf == NULL)
     return GRUB_ERR_BAD_ARGUMENT;