mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
![]() In tpm_tis_mmio_read(), tpm_tis_mmio_write() and tpm_tis_dump_state(), we calculate a locality index with tpm_tis_locality_from_addr() and then use it as an index into the s->loc[] array. In all these cases, the array index can't overflow because the MemoryRegion is sized to be TPM_TIS_NUM_LOCALITIES << TPM_TIS_LOCALITY_SHIFT bytes. However, Coverity can't see that, and it complains (CID 1487138, 1487180, 1487188, 1487198, 1487240). Add an assertion to tpm_tis_locality_from_addr() that the calculated locality index is valid, which will help Coverity and also catch any potential future bug where the MemoryRegion isn't sized exactly. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20220525125904.483075-1-stefanb@linux.ibm.com |
||
---|---|---|
.. | ||
Kconfig | ||
meson.build | ||
tpm_crb.c | ||
tpm_ppi.c | ||
tpm_ppi.h | ||
tpm_prop.h | ||
tpm_spapr.c | ||
tpm_tis.h | ||
tpm_tis_common.c | ||
tpm_tis_isa.c | ||
tpm_tis_sysbus.c | ||
trace-events | ||
trace.h |