[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] tpm_tis: validate locality values don't overrun arr
From: |
Liam Merwick |
Subject: |
[Qemu-devel] [PATCH] tpm_tis: validate locality values don't overrun array |
Date: |
Wed, 30 Jan 2019 14:45:50 +0000 |
Assert that various locality values don't exceed TPM_TIS_NUM_LOCALITIES
by adding specific calls to assert(TPM_TIS_NUM_LOCALITIES(l)) in order
to help static code analysis.
Signed-off-by: Liam Merwick <address@hidden>
---
hw/tpm/tpm_tis.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c
index fd6bb9b59a96..2267bd8c346f 100644
--- a/hw/tpm/tpm_tis.c
+++ b/hw/tpm/tpm_tis.c
@@ -241,6 +241,9 @@ static void tpm_tis_abort(TPMState *s)
{
s->rw_offset = 0;
+ assert(TPM_TIS_IS_VALID_LOCTY(s->next_locty));
+ assert(TPM_TIS_IS_VALID_LOCTY(s->aborting_locty));
+
trace_tpm_tis_abort(s->next_locty);
/*
@@ -531,6 +534,8 @@ static void tpm_tis_mmio_write(void *opaque, hwaddr addr,
uint16_t len;
uint32_t mask = (size == 1) ? 0xff : ((size == 2) ? 0xffff : ~0);
+ assert(TPM_TIS_IS_VALID_LOCTY(locty));
+
trace_tpm_tis_mmio_write(size, addr, val);
if (locty == 4) {
--
1.8.3.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH] tpm_tis: validate locality values don't overrun array,
Liam Merwick <=