From: Stefan Berger Date: Tue, 30 Oct 2018 21:32:56 +0000 (-0400) Subject: tpm: Zero-init structure to avoid uninitialized variables in valgrind log X-Git-Tag: v3.1.0-rc0~21^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eff1fe9fd0cebe2293eea9597616f792b6b5ad18;p=thirdparty%2Fqemu.git tpm: Zero-init structure to avoid uninitialized variables in valgrind log Zero-init the ptm_loc structure so that we don't have fields that are not initialised. Signed-off-by: Stefan Berger Reviewed-by: Philippe Mathieu-Daudé --- diff --git a/hw/tpm/tpm_emulator.c b/hw/tpm/tpm_emulator.c index 10bc20dbec4..70f4b10284f 100644 --- a/hw/tpm/tpm_emulator.c +++ b/hw/tpm/tpm_emulator.c @@ -166,6 +166,7 @@ static int tpm_emulator_set_locality(TPMEmulator *tpm_emu, uint8_t locty_number, trace_tpm_emulator_set_locality(locty_number); + memset(&loc, 0, sizeof(loc)); loc.u.req.loc = locty_number; if (tpm_emulator_ctrlcmd(tpm_emu, CMD_SET_LOCALITY, &loc, sizeof(loc), sizeof(loc)) < 0) {