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 <adham...@gmail.com>
---
 util/grub-protect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/grub-protect.c b/util/grub-protect.c
index 40d4a3fc5..9ca289719 100644
--- a/util/grub-protect.c
+++ b/util/grub-protect.c
@@ -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;
-- 
2.39.5


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to