u-boot/drivers/tpm
Miquel Raynal fd973ca696 tpm: sandbox: fix wrong check on pcr_map
The second check on pcr_map in sandbox_tpm2_xfer() is wrong. It should
check for pcr_map not being empty. Instead, it is a pure copy/paste of
the first check which is redundant.

This has been found thanks to a Coverity Scan report:

    CID 183370:  Memory - illegal accesses  (UNINIT)
    Using uninitialized value "pcr_index".
        put_unaligned_be32(tpm->pcr_extensions[pcr_index], recv);

This is because pcr_index is initialized only if the user input is
correct, ie. at least one valid bit is set in pcr_map.

Fix the second check and also initialize pcr_index to 0 (which is
harmless in case of error) to make Coverity Scan happy.

Reported-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-08-13 14:04:04 -04:00
..
Kconfig tpm: make TPM_V2 be compiled by default 2018-07-28 11:58:09 -04:00
Makefile tpm: add a Sandbox TPMv2.x driver 2018-05-25 20:13:00 -04:00
tpm-uclass.c tpm: allow TPM v1 and v2 to be compiled at the same time 2018-07-28 11:57:38 -04:00
tpm2_tis_sandbox.c tpm: sandbox: fix wrong check on pcr_map 2018-08-13 14:04:04 -04:00
tpm2_tis_spi.c tpm: allow TPM v1 and v2 to be compiled at the same time 2018-07-28 11:57:38 -04:00
tpm_atmel_twi.c tpm: disociate TPMv1.x specific and generic code 2018-05-25 20:12:55 -04:00
tpm_internal.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
tpm_tis.h tpm: add Revision ID field in the chip structure 2018-05-25 08:12:40 -04:00
tpm_tis_infineon.c tpm: disociate TPMv1.x specific and generic code 2018-05-25 20:12:55 -04:00
tpm_tis_lpc.c tpm: disociate TPMv1.x specific and generic code 2018-05-25 20:12:55 -04:00
tpm_tis_sandbox.c tpm: disociate TPMv1.x specific and generic code 2018-05-25 20:12:55 -04:00
tpm_tis_st33zp24_i2c.c tpm: disociate TPMv1.x specific and generic code 2018-05-25 20:12:55 -04:00
tpm_tis_st33zp24_spi.c tpm: disociate TPMv1.x specific and generic code 2018-05-25 20:12:55 -04:00