tpm2: Require TPM_NV_DISK to avoid case of tpm_stata_path being NULL

Address an issue reported by cppcheck that raises the issue that
tpm_state_path could be NULL when the #define TPM_NV_DISK is not set.
Require that the #define TPM_NV_DISK always be set.

Resolves: https://github.com/stefanberger/libtpms/issues/313
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2022-04-01 08:41:30 -04:00
parent 5bc860ac37
commit 73fca84031

View File

@ -123,6 +123,8 @@ TPM_RESULT TPM_NVRAM_Init(void)
rc = TPM_FAIL;
}
}
#else
# error TPM_NV_DISK must be defined
#endif
/* check that the directory name plus a file name will not overflow FILENAME_MAX */
if (rc == 0) {