Package: libtpms
Version: 0.8.0~dev1-1.2
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu hirsute ubuntu-patch

Hi Seunghun,

The libtpms package is failing to build from source on s390x in Ubuntu,
because the compiler detects that certain variables may be used before they
have been initialized.  Due to some oddities in the toolchain configuration,
the compiler output is not shown in the build logs, however I've manually
analyzed the failure and identified the attached patch which will fix the
build failure.

While the issue was only detected on Ubuntu/s390x, it is a generic issue
with the code, so I think the patch should be applied for correctness.

Thanks for considering,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                   https://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru libtpms-0.8.0~dev1/debian/patches/series 
libtpms-0.8.0~dev1/debian/patches/series
--- libtpms-0.8.0~dev1/debian/patches/series    2020-08-08 10:31:09.000000000 
-0700
+++ libtpms-0.8.0~dev1/debian/patches/series    2020-12-09 08:57:06.000000000 
-0800
@@ -2,3 +2,4 @@
 0002-fix-man-page-longline-typo.patch
 0003-set-man-page-date-to-last-changelog.patch
 0004-fix-ftbfs-bug.patch
+uninitialized-variable.patch
diff -Nru libtpms-0.8.0~dev1/debian/patches/uninitialized-variable.patch 
libtpms-0.8.0~dev1/debian/patches/uninitialized-variable.patch
--- libtpms-0.8.0~dev1/debian/patches/uninitialized-variable.patch      
1969-12-31 16:00:00.000000000 -0800
+++ libtpms-0.8.0~dev1/debian/patches/uninitialized-variable.patch      
2020-12-09 11:31:11.000000000 -0800
@@ -0,0 +1,31 @@
+Description: fix issues of variables that may be used before initialization
+ Detected by gcc on Ubuntu/s390x
+Author: Steve Langasek <steve.langa...@ubuntu.com>
+Last-Update: 2020-12-09
+
+Index: libtpms-0.8.0~dev1/src/tpm12/tpm_nvram.c
+===================================================================
+--- libtpms-0.8.0~dev1.orig/src/tpm12/tpm_nvram.c
++++ libtpms-0.8.0~dev1/src/tpm12/tpm_nvram.c
+@@ -1997,7 +1997,7 @@
+     TPM_BOOL                  done = FALSE;
+     TPM_BOOL                  dir = FALSE;
+     TPM_BOOL                  writeAllNV = FALSE;     /* flag to write back 
NV */
+-    TPM_NV_DATA_SENSITIVE     *d1NvdataSensitive;
++    TPM_NV_DATA_SENSITIVE     *d1NvdataSensitive = NULL;
+     uint32_t                  s1Last;
+     TPM_BOOL                  physicalPresence;
+     TPM_BOOL                  isGPIO = FALSE;
+Index: libtpms-0.8.0~dev1/src/tpm2/Marshal.c
+===================================================================
+--- libtpms-0.8.0~dev1.orig/src/tpm2/Marshal.c
++++ libtpms-0.8.0~dev1/src/tpm2/Marshal.c
+@@ -2219,7 +2219,7 @@
+ TPM2B_CREATION_DATA_Marshal(TPM2B_CREATION_DATA *source, BYTE **buffer, INT32 
*size)
+ {
+     UINT16 written = 0;
+-    BYTE *sizePtr;
++    BYTE *sizePtr = NULL;
+ 
+     if (buffer != NULL) {
+       sizePtr = *buffer;

Reply via email to