From 6b998580d6984dd1fea024bdd4fffed993d04bc5 Mon Sep 17 00:00:00 2001 From: yingbinx Date: Wed, 12 Dec 2018 15:30:23 +0800 Subject: [PATCH] Fix KW issues for tpm_emulator There are several KW issues which uninitialized variables are used. This patch will fix those KW issues. Signed-off-by: weideng Signed-off-by: yingbinx --- devicemodel/hw/platform/tpm/tpm_emulator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/devicemodel/hw/platform/tpm/tpm_emulator.c b/devicemodel/hw/platform/tpm/tpm_emulator.c index e4ff4105d..da34ba5aa 100644 --- a/devicemodel/hw/platform/tpm/tpm_emulator.c +++ b/devicemodel/hw/platform/tpm/tpm_emulator.c @@ -531,7 +531,7 @@ static int swtpm_ctrlchan_create(const char *arg_path) */ static int swtpm_cmdchan_create(void) { - ptm_res res; + ptm_res res = 0; int sv[2] = {-1, -1}; if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) < 0) @@ -584,7 +584,7 @@ err_exit: static int swtpm_stop(void) { - ptm_res res; + ptm_res res = 0; if (swtpm_ctrlcmd(tpm_context.ctrl_chan_fd, CMD_STOP, &res, 0, sizeof(res), NULL, 0) < 0) { printf("swtpm: Could not stop TPM: %s", strerror(errno)); @@ -663,7 +663,7 @@ static int swtpm_startup_tpm(size_t buffersize, static void swtpm_shutdown(void) { - ptm_res res; + ptm_res res = 0; if (swtpm_ctrlcmd(tpm_context.ctrl_chan_fd, CMD_SHUTDOWN, &res, 0, sizeof(res), NULL, 0) < 0) { @@ -789,7 +789,7 @@ int swtpm_reset_tpm_established_flag(void) void swtpm_cancel_cmd(void) { - ptm_res res; + ptm_res res = 0; if (swtpm_ctrlcmd(tpm_context.ctrl_chan_fd, CMD_CANCEL_TPM_CMD, &res, 0, sizeof(res), NULL, 0) < 0) {