aboutsummaryrefslogtreecommitdiff
path: root/hw/tpm
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2018-12-04 09:54:39 -0500
committerStefan Berger <stefanb@linux.vnet.ibm.com>2018-12-04 10:21:25 -0500
commita639f96111eadb3b8e3021fd3f27e2948ad1c640 (patch)
tree3b711eb6a53d03211c91a6e92b06a3825f79af16 /hw/tpm
parente92b63ea610201bd743343fc6b11e6c39c8d3515 (diff)
tpm: Make sure the locality received from backend is valid
Make sure that the locality passed from the backend to tpm_tis_request_completed() is valid. Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'hw/tpm')
-rw-r--r--hw/tpm/tpm_tis.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index 04e4ad9212..2563d7501f 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -295,6 +295,8 @@ static void tpm_tis_request_completed(TPMIf *ti, int ret)
uint8_t locty = s->cmd.locty;
uint8_t l;
+ assert(TPM_TIS_IS_VALID_LOCTY(locty));
+
if (s->cmd.selftest_done) {
for (l = 0; l < TPM_TIS_NUM_LOCALITIES; l++) {
s->loc[l].sts |= TPM_TIS_STS_SELFTEST_DONE;