mirror of
https://github.com/stefanberger/libtpms
synced 2026-08-11 20:59:34 +00:00
tpm12: Initialize some variables for gcc-5 ppc64el compiler
The -O3 passed to the ppc64el gcc-5 compiler on Ubuntu 16.04 causes
the following false positives:
gcc-5 -DHAVE_CONFIG_H -I. -I.. -include tpm_library_conf.h -I../include/libtpms -I../include/libtpms -fstack-protector-strong -DTPM_V12 -DTPM_PCCLIENT -DTPM_VOLATILE_LOAD -DTPM_ENABLE_ACTIVATE -DTPM_AES -DTPM_LIBTPMS_CALLBACKS -DTPM_NV_DISK -DTPM_POSIX -DTPM_NOMAINTENANCE_COMMANDS -g -O3 -fstack-protector-strong -DUSE_OPENSSL_FUNCTIONS_SYMMETRIC=1 -DUSE_OPENSSL_FUNCTIONS_EC=1 -DUSE_OPENSSL_FUNCTIONS_ECDSA=0 -DUSE_OPENSSL_FUNCTIONS_RSA=0 -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign -MT tpm12/libtpms_tpm12_la-tpm_session.lo -MD -MP -MF tpm12/.deps/libtpms_tpm12_la-tpm_session.Tpo -c tpm12/tpm_session.c -o tpm12/libtpms_tpm12_la-tpm_session.o
tpm12/tpm_session.c: In function ‘TPM_Process_SaveContext’:
tpm12/tpm_session.c:3056:16: error: ‘contextIndex’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
uint32_t contextIndex; /* free index in context list */
^
tpm12/tpm_session.c: In function ‘TPM_Process_SaveAuthContext’:
tpm12/tpm_session.c:4934:16: error: ‘contextIndex’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
uint32_t contextIndex; /* free index in context list */
^
This patch initializes these variables to 0.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
259d9f8b14
commit
ece2ce84ea
@ -3053,7 +3053,7 @@ TPM_RESULT TPM_Process_SaveContext(tpm_state_t *tpm_state,
|
||||
TPM_CONTEXT_SENSITIVE c1ContextSensitive;
|
||||
TPM_CONTEXT_BLOB b1ContextBlob;
|
||||
TPM_STORE_BUFFER c1_sbuffer; /* serialization of c1ContextSensitive */
|
||||
uint32_t contextIndex; /* free index in context list */
|
||||
uint32_t contextIndex = 0; /* free index in context list */
|
||||
uint32_t space; /* free space in context list */
|
||||
TPM_BOOL isZero;
|
||||
|
||||
@ -4931,7 +4931,7 @@ TPM_RESULT TPM_Process_SaveAuthContext(tpm_state_t *tpm_state,
|
||||
TPM_AUTH_SESSION_DATA *tpm_auth_session_data; /* session table entry for the handle */
|
||||
TPM_BOOL isZero; /* contextNonceSession not set yet */
|
||||
TPM_STCLEAR_DATA *v1StClearData = NULL;
|
||||
uint32_t contextIndex; /* free index in context list */
|
||||
uint32_t contextIndex = 0; /* free index in context list */
|
||||
uint32_t space; /* free space in context list */
|
||||
TPM_CONTEXT_SENSITIVE contextSensitive;
|
||||
TPM_STORE_BUFFER contextSensitive_sbuffer; /* serialization of contextSensitive */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user