Skip to content

Commit 6b99858

Browse files
yingbinxwenlingz
authored andcommitted
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 <wei.a.deng@intel.com> Signed-off-by: yingbinx <yingbinx.zeng@intel.com>
1 parent 2d469a5 commit 6b99858

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

devicemodel/hw/platform/tpm/tpm_emulator.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ static int swtpm_ctrlchan_create(const char *arg_path)
531531
*/
532532
static int swtpm_cmdchan_create(void)
533533
{
534-
ptm_res res;
534+
ptm_res res = 0;
535535
int sv[2] = {-1, -1};
536536

537537
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) < 0)
@@ -584,7 +584,7 @@ static int swtpm_start(ptm_init *init)
584584

585585
static int swtpm_stop(void)
586586
{
587-
ptm_res res;
587+
ptm_res res = 0;
588588

589589
if (swtpm_ctrlcmd(tpm_context.ctrl_chan_fd, CMD_STOP, &res, 0, sizeof(res), NULL, 0) < 0) {
590590
printf("swtpm: Could not stop TPM: %s", strerror(errno));
@@ -663,7 +663,7 @@ static int swtpm_startup_tpm(size_t buffersize,
663663

664664
static void swtpm_shutdown(void)
665665
{
666-
ptm_res res;
666+
ptm_res res = 0;
667667

668668
if (swtpm_ctrlcmd(tpm_context.ctrl_chan_fd, CMD_SHUTDOWN,
669669
&res, 0, sizeof(res), NULL, 0) < 0) {
@@ -789,7 +789,7 @@ int swtpm_reset_tpm_established_flag(void)
789789

790790
void swtpm_cancel_cmd(void)
791791
{
792-
ptm_res res;
792+
ptm_res res = 0;
793793

794794
if (swtpm_ctrlcmd(tpm_context.ctrl_chan_fd, CMD_CANCEL_TPM_CMD, &res, 0,
795795
sizeof(res), NULL, 0) < 0) {

0 commit comments

Comments
 (0)