All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Hamilton <adhamilt@gmail.com>
To: grub-devel@gnu.org
Cc: daniel.kiper@oracle.com, rudi@heitbaum.com, phcoder@gmail.com,
	Andrew Hamilton <adhamilt@gmail.com>
Subject: [PATCH v2 2/2] util/grub-protect: Correct uninit 'err' Variable
Date: Tue, 17 Jun 2025 20:58:26 -0500	[thread overview]
Message-ID: <20250618015826.270234-3-adhamilt@gmail.com> (raw)
In-Reply-To: <20250618015826.270234-1-adhamilt@gmail.com>

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>
---
 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 d53c2572d..868eb76b9 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

  parent reply	other threads:[~2025-06-18  1:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18  1:58 [PATCH v2 0/2] Correct Build Failures with GCC-15 and CLANG Andrew Hamilton
2025-06-18  1:58 ` [PATCH v2 1/2] gnulib: Add patch to allow GRUB w/GCC-15 compile Andrew Hamilton
2025-06-18  5:06   ` sudhakar
2025-06-18  1:58 ` Andrew Hamilton [this message]
2025-06-18  4:40   ` [PATCH v2 2/2] util/grub-protect: Correct uninit 'err' Variable sudhakar
2025-06-18 14:19 ` [PATCH v2 0/2] Correct Build Failures with GCC-15 and CLANG Daniel Kiper via Grub-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250618015826.270234-3-adhamilt@gmail.com \
    --to=adhamilt@gmail.com \
    --cc=daniel.kiper@oracle.com \
    --cc=grub-devel@gnu.org \
    --cc=phcoder@gmail.com \
    --cc=rudi@heitbaum.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.