]> git.sur5r.net Git - u-boot/commitdiff
drivers/tpm/tpm_tis_sandbox.c: Fix uninitialized variable use
authorTom Rini <trini@konsulko.com>
Tue, 12 Apr 2016 19:11:22 +0000 (15:11 -0400)
committerSimon Glass <sjg@chromium.org>
Fri, 15 Apr 2016 14:14:37 +0000 (08:14 -0600)
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 <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
drivers/tpm/tpm_tis_sandbox.c

index 4aade565e27a78a5b0da9ba962c4cab386b1c8cc..e7746dc67590776d8378fda7b821607022db23b1 100644 (file)
@@ -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));