[PATCH] qemuTPMEmulatorReconfigure: Fix two build issues

Peter Krempa posted 1 patch 2 years, 5 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/c43f22d5c1ea08c5516d791010ed3c230c47cb53.1636102569.git.pkrempa@redhat.com
src/qemu/qemu_tpm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] qemuTPMEmulatorReconfigure: Fix two build issues
Posted by Peter Krempa 2 years, 5 months ago
1) 'activePcrBanksStr' is not initialized:

../../../libvirt/src/qemu/qemu_tpm.c: In function ‘qemuExtTPMStart’:
/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: error: ‘activePcrBanksStr’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   28 |   g_free (*pp);
      |   ^~~~~~~~~~~~
../../../libvirt/src/qemu/qemu_tpm.c:613:22: note: ‘activePcrBanksStr’ was declared here
  613 |     g_autofree char *activePcrBanksStr;
      |                      ^~~~~~~~~~~~~~~~~

2) 'pwdfile_fd' is unused:

../../../libvirt/src/qemu/qemu_tpm.c:615:19: error: unused variable 'pwdfile_fd' [-Werror,-Wunused-variable]
        VIR_AUTOCLOSE pwdfile_fd = -1;

Fixes: a5bbe1a8b63
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---

Pushed.

 src/qemu/qemu_tpm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 25890a8589..7d05394356 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -610,9 +610,8 @@ qemuTPMEmulatorReconfigure(const char *storagepath,
 {
     g_autoptr(virCommand) cmd = NULL;
     int exitstatus;
-    g_autofree char *activePcrBanksStr;
+    g_autofree char *activePcrBanksStr = NULL;
     g_autofree char *swtpm_setup = virTPMGetSwtpmSetup();
-    VIR_AUTOCLOSE pwdfile_fd = -1;

     if (!swtpm_setup)
         return -1;
-- 
2.31.1