From: Tom Rini Date: Tue, 12 Apr 2016 19:11:22 +0000 (-0400) Subject: drivers/tpm/tpm_tis_sandbox.c: Fix uninitialized variable use X-Git-Tag: v2016.05-rc2~54 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7e019daf7ab9dca3bf782d6de866b36d44ede95e;p=u-boot drivers/tpm/tpm_tis_sandbox.c: Fix uninitialized variable use In rollback_space_kernel we were not initializing the reserved fields which should be for safety sake, and doing memset here means we don't need to set the version field specifically either. Reported-by: Coverity (CID: 143917) Cc: Simon Glass Signed-off-by: Tom Rini --- diff --git a/drivers/tpm/tpm_tis_sandbox.c b/drivers/tpm/tpm_tis_sandbox.c index 4aade565e2..e7746dc675 100644 --- a/drivers/tpm/tpm_tis_sandbox.c +++ b/drivers/tpm/tpm_tis_sandbox.c @@ -214,9 +214,9 @@ static int sandbox_tpm_xfer(struct udevice *dev, const uint8_t *sendbuf, data = recvbuf + TPM_RESPONSE_HEADER_LENGTH + sizeof(uint32_t); + memset(&rsk, 0, sizeof(struct rollback_space_kernel)); rsk.struct_version = 2; rsk.uid = ROLLBACK_SPACE_KERNEL_UID; - rsk.kernel_versions = 0; rsk.crc8 = crc8(0, (unsigned char *)&rsk, offsetof(struct rollback_space_kernel, crc8));