From aaab5d0b16e2b0437d3aa1d2efc4736d3775b374 Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Thu, 7 Dec 2017 17:05:58 -0500 Subject: [PATCH] swtpm_bios: Coverity: use void * for the command Use void * for the command rather than tpm_header *, which we do not need. This addresses a few Coverity complaints. Signed-off-by: Stefan Berger --- src/swtpm_bios/tpm_bios.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/swtpm_bios/tpm_bios.c b/src/swtpm_bios/tpm_bios.c index 952e748..27fd3d2 100644 --- a/src/swtpm_bios/tpm_bios.c +++ b/src/swtpm_bios/tpm_bios.c @@ -218,7 +218,7 @@ use_device: } -static int talk(const struct tpm_header *hdr, size_t count, int *tpm_errcode, +static int talk(const void *cmd, size_t count, int *tpm_errcode, unsigned int to_seconds, struct tpm_resp_header *res, size_t res_size) { @@ -238,7 +238,7 @@ static int talk(const struct tpm_header *hdr, size_t count, int *tpm_errcode, goto err_exit; } - len = write(fd, hdr, count); + len = write(fd, cmd, count); if (len < 0 || (size_t)len != count) { fprintf(stderr, "Write to file descriptor failed.\n"); goto err_close_fd; @@ -300,7 +300,7 @@ static int TPM_Startup(unsigned char parm, int *tpm_errcode) .startup_type = htobe16(parm), }; - return talk(&tss.hdr, sizeof(tss), tpm_errcode, TPM_DURATION_SHORT, + return talk(&tss, sizeof(tss), tpm_errcode, TPM_DURATION_SHORT, NULL, 0); } @@ -316,7 +316,7 @@ static int TSC_PhysicalPresence(unsigned short physical_presence, .physical_presence = htobe16(physical_presence), }; - return talk(&tpp.hdr, sizeof(tpp), tpm_errcode, TPM_DURATION_SHORT, + return talk(&tpp, sizeof(tpp), tpm_errcode, TPM_DURATION_SHORT, NULL, 0); } @@ -335,7 +335,7 @@ static int TPM_GetCapability_Subcap(uint32_t cap, uint32_t subcap, .subcap = htobe32(subcap), }; - return talk(&tgc.hdr, sizeof(tgc), tpm_errcode, TPM_DURATION_SHORT, + return talk(&tgc, sizeof(tgc), tpm_errcode, TPM_DURATION_SHORT, res, res_size); } @@ -349,7 +349,7 @@ static int TPM_PhysicalEnable(int *tpm_errcode) }, }; - return talk(&tpe.hdr, sizeof(tpe), tpm_errcode, TPM_DURATION_SHORT, + return talk(&tpe, sizeof(tpe), tpm_errcode, TPM_DURATION_SHORT, NULL, 0); } @@ -364,7 +364,7 @@ static int TPM_PhysicalSetDeactivated(unsigned char parm, int *tpm_errcode) .state = parm, }; - return talk(&tpsd.hdr, sizeof(tpsd), tpm_errcode, TPM_DURATION_SHORT, + return talk(&tpsd, sizeof(tpsd), tpm_errcode, TPM_DURATION_SHORT, NULL, 0); } @@ -378,7 +378,7 @@ static int TPM_ContinueSelfTest(int *tpm_errcode) }, }; - return talk(&tcs.hdr, sizeof(tcs), tpm_errcode, TPM_DURATION_LONG, + return talk(&tcs, sizeof(tcs), tpm_errcode, TPM_DURATION_LONG, NULL, 0); }