Defensive check to prevent future caller passing incorrect address or catch if the MMIO address parameters were not all changed together.
Signed-off-by: Liam Merwick <liam.merw...@oracle.com> --- I've been running static analysis tools on QEMU and one reports this check. While it's just theoretically correct (impossible to hit with current code), fixing this helps minimise noise and find other issues using those static analyzers as well as defending against the addition of future bugs. hw/tpm/tpm_tis.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index 61a130beef35..860c2ace7d99 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -100,6 +100,7 @@ static uint64_t tpm_tis_mmio_read(void *opaque, hwaddr addr, static uint8_t tpm_tis_locality_from_addr(hwaddr addr) { + assert(addr < TPM_TIS_ADDR_SIZE); return (uint8_t)((addr >> TPM_TIS_LOCALITY_SHIFT) & 0x7); } -- 1.8.3.1