swtpm/0001-swtpm_setup-Initialized-argv-to-NULL-Fedore-Rawhide.patch
2022-11-10 15:00:55 -05:00

46 lines
1.7 KiB
Diff

From 5b8c9d205a59932ce4e1894dbf09f5df4cfbb907 Mon Sep 17 00:00:00 2001
From: Stefan Berger <stefanb@linux.ibm.com>
Date: Thu, 10 Nov 2022 14:20:53 -0500
Subject: [PATCH] swtpm_setup: Initialized **argv to NULL (Fedore Rawhide)
gcc 12.2.1 on Fedora Rawhide emits this message:
In file included from /usr/include/glib-2.0/glib.h:116,
from swtpm_setup.c:26:
In function 'g_autoptr_cleanup_generic_gfree',
inlined from 'get_swtpm_capabilities.constprop.0' at swtpm_setup.c:940:24:
/usr/include/glib-2.0/glib/glib-autocleanups.h:30:3: error: 'argv' may be used uninitialized [-Werror=maybe-uninitialized]
30 | g_free (*pp);
| ^~~~~~~~~~~~
swtpm_setup.c: In function 'get_swtpm_capabilities.constprop.0':
swtpm_setup.c:940:24: note: 'argv' was declared here
940 | g_autofree gchar **argv;
| ^~~~
cc1: all warnings being treated as errors
This makes little sense since the variable is then first used like this:
argv = concat_arrays(swtpm_prg_l, my_argv, FALSE);
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
src/swtpm_setup/swtpm_setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/swtpm_setup/swtpm_setup.c b/src/swtpm_setup/swtpm_setup.c
index 1b528c8..3570235 100644
--- a/src/swtpm_setup/swtpm_setup.c
+++ b/src/swtpm_setup/swtpm_setup.c
@@ -937,7 +937,7 @@ static int get_swtpm_capabilities(gchar **swtpm_prg_l, gboolean is_tpm2,
gchar *my_argv[] = { "--print-capabilities", is_tpm2 ? "--tpm2" : NULL, NULL };
g_autofree gchar *logop = NULL;
g_autoptr(GError) error = NULL;
- g_autofree gchar **argv;
+ g_autofree gchar **argv = NULL;
int exit_status = 0;
gboolean success;
int ret = 1;
--
2.38.0