From 256ade770677727e823cd6f05680d5a9c5e397e3 Mon Sep 17 00:00:00 2001 From: Jiabo Feng Date: Mon, 28 Aug 2023 09:58:25 +0800 Subject: [PATCH] swtpm_setup: Initialized @argv in get_swtpm_capabilities() The compiler (though wrongly) identifies that the @argv variable inside of get_swtpm_capabilities() function cam be used uninitialized. While this is a spurious warning, it's common practice to initialize g_autofree variables to NULL. Signed-off-by: Michal Privoznik --- ...ialized-argv-in-get_swtpm_capabiliti.patch | 31 +++++++++++++++++++ swtpm.spec | 6 +++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 0001-swtpm_setup-Initialized-argv-in-get_swtpm_capabiliti.patch diff --git a/0001-swtpm_setup-Initialized-argv-in-get_swtpm_capabiliti.patch b/0001-swtpm_setup-Initialized-argv-in-get_swtpm_capabiliti.patch new file mode 100644 index 0000000..7308c8f --- /dev/null +++ b/0001-swtpm_setup-Initialized-argv-in-get_swtpm_capabiliti.patch @@ -0,0 +1,31 @@ +From 72d9c031a01e567d4bb172ce4f33e97f5659b4f8 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Mon, 19 Dec 2022 09:27:57 +0100 +Subject: [PATCH] swtpm_setup: Initialized @argv in get_swtpm_capabilities() + +The compiler (though wrongly) identifies that the @argv variable +inside of get_swtpm_capabilities() function cam be used +uninitialized. While this is a spurious warning, it's common +practice to initialize g_autofree variables to NULL. + +Signed-off-by: Michal Privoznik +--- + 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.41.0.windows.1 + diff --git a/swtpm.spec b/swtpm.spec index a7622e8..53ebfc0 100644 --- a/swtpm.spec +++ b/swtpm.spec @@ -8,11 +8,12 @@ Summary: TPM Emulator Name: swtpm Version: 0.8.0 -Release: 2 +Release: 3 License: BSD Url: https://github.com/stefanberger/swtpm Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz Patch00: 0000-disable-test_tpm2_swtpm_localca_pkcs11.test.patch +Patch01: 0001-swtpm_setup-Initialized-argv-in-get_swtpm_capabiliti.patch BuildRequires: automake BuildRequires: autoconf @@ -172,6 +173,9 @@ fi %attr( 750, tss, root) %{_localstatedir}/lib/swtpm-localca %changelog +* Mon Aug 28 2023 Jiabo Feng - 0.8.0-3 +- swtpm_setup: Initialized @argv in get_swtpm_capabilities() + * Tue Mar 07 2023 jiangfangjie - 0.8.0-2 - Remove rpath -- Gitee