]> git.proxmox.com Git - mirror_qemu.git/commitdiff
tpm: Make sure the locality received from backend is valid
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Tue, 4 Dec 2018 14:54:39 +0000 (09:54 -0500)
committerStefan Berger <stefanb@linux.vnet.ibm.com>
Tue, 4 Dec 2018 15:21:25 +0000 (10:21 -0500)
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>
hw/tpm/tpm_tis.c

index 04e4ad9212d67c0fa5381d6f948d653c79a3600f..2563d7501fc384e18b891f8cde1a2d139ef32e22 100644 (file)
@@ -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;