mirror of
https://github.com/stefanberger/libtpms
synced 2026-01-20 03:12:40 +00:00
tpm2: Initialize needed_size with 0
gcc 4.2.1 on i386 OpenBSD complains about needed_size being used uninitilized. It seems a false positive but we can still initialize it to 0. Also set t = NULL in the error case to speed up the exit from the loop. Signed-off-by: Stefam Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
7827f8450b
commit
3606971639
@ -805,7 +805,7 @@ PCR_SAVE_Unmarshal(PCR_SAVE *data, BYTE **buffer, INT32 *size,
|
||||
const TPML_PCR_SELECTION *pcrAllocated)
|
||||
{
|
||||
TPM_RC rc = TPM_RC_SUCCESS;
|
||||
UINT16 array_size, needed_size;
|
||||
UINT16 array_size, needed_size = 0;
|
||||
NV_HEADER hdr;
|
||||
TPM_ALG_ID algid;
|
||||
BOOL end = FALSE;
|
||||
@ -873,6 +873,7 @@ PCR_SAVE_Unmarshal(PCR_SAVE *data, BYTE **buffer, INT32 *size,
|
||||
TPMLIB_LogTPM2Error("PCR_SAVE: Unsupported algid %d.",
|
||||
algid);
|
||||
rc = TPM_RC_BAD_PARAMETER;
|
||||
t = NULL;
|
||||
}
|
||||
}
|
||||
if (t) {
|
||||
@ -994,7 +995,7 @@ PCR_Unmarshal(PCR *data, BYTE **buffer, INT32 *size,
|
||||
NV_HEADER hdr;
|
||||
BOOL end = FALSE;
|
||||
BYTE *t = NULL;
|
||||
UINT16 needed_size, array_size;
|
||||
UINT16 needed_size = 0, array_size;
|
||||
TPM_ALG_ID algid;
|
||||
UINT64 algs_needed = pcrbanks_algs_active(pcrAllocated);
|
||||
|
||||
@ -1048,6 +1049,7 @@ PCR_Unmarshal(PCR *data, BYTE **buffer, INT32 *size,
|
||||
TPMLIB_LogTPM2Error("PCR: Unsupported algid %d.",
|
||||
algid);
|
||||
rc = TPM_RC_BAD_PARAMETER;
|
||||
t = NULL;
|
||||
}
|
||||
}
|
||||
if (t) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user