Skip to contentSkip to conversation

tpm: Prevent a call to TPM if no TPM support is requested

PATCH In review Stefan Berger 2 participants 2 messages Jun 2, 2015 – Jun 3, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: Prevent a call to TPM if no TPM support is requested

Prevent the function tpm_tis_get_tpm_version() from being called if not TPM support is requested.

---
 include/sysemu/tpm.h | 2 ++
 1 file changed, 2 insertions(+)
include/sysemu/tpm.h +2 -0
index c143890..c8afa17 100644
@@ -32,11 +32,13 @@ TPMVersion tpm_tis_get_tpm_version(Object *obj);
 
 static inline TPMVersion tpm_get_version(void)
 {
+#ifdef CONFIG_TPM
     Object *obj = object_resolve_path_type("", TYPE_TPM_TIS, NULL);
 
     if (obj) {
         return tpm_tis_get_tpm_version(obj);
     }
+#endif
     return TPM_VERSION_UNSPEC;
 }
 
Signature · 1 line
1.9.3
#1 lore raw
Quoted 15 lines · Stefan Berger

Prevent the function tpm_tis_get_tpm_version() from being called if not TPM support is requested.

---
 include/sysemu/tpm.h | 2 ++
 1 file changed, 2 insertions(+)
include/sysemu/tpm.h +0 -0
index c143890..c8afa17 100644
@@ -32,11 +32,13 @@ TPMVersion tpm_tis_get_tpm_version(Object *obj);
 
 static inline TPMVersion tpm_get_version(void)

include/sysemu/tpm.h TPMVersion tpm_tis_get_tpm_version(Object *obj); · line 43

Quoted 10 lines
include/sysemu/tpm.h +2 -0
 {
+#ifdef CONFIG_TPM
     Object *obj = object_resolve_path_type("", TYPE_TPM_TIS, NULL);
 
     if (obj) {
         return tpm_tis_get_tpm_version(obj);
     }
+#endif
     return TPM_VERSION_UNSPEC;
 }

I sent basically the same patch to mst and to the list.

I don't care which one is picked.

Thanks, Juan.