aboutsummaryrefslogtreecommitdiff
path: root/lib/libtpm/tpm_drivers.c
diff options
context:
space:
mode:
authorAlexey Kardashevskiy <aik@ozlabs.ru>2021-01-27 19:38:30 +1100
committerAlexey Kardashevskiy <aik@ozlabs.ru>2021-02-12 13:46:16 +1100
commit1d1615b7b79109aedce51be3fd73baec040418b4 (patch)
tree168efa1668ea0cbf960cd71f400c0ade9aa4145c /lib/libtpm/tpm_drivers.c
parent09b201101478e6e1c858fc4ef4f859d88a2b8a49 (diff)
downloadSLOF-1d1615b7b79109aedce51be3fd73baec040418b4.zip
SLOF-1d1615b7b79109aedce51be3fd73baec040418b4.tar.gz
SLOF-1d1615b7b79109aedce51be3fd73baec040418b4.tar.bz2
libtpm: Compile with -Wextra
-Wextra enables a bunch of rather useful checks which this fixes. Note this adds MIN() in tpm_gpt_set_lba1() so it may potentially fail which is unlikely as the length comes from disk-label's block-size which is used in other places. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Diffstat (limited to 'lib/libtpm/tpm_drivers.c')
-rw-r--r--lib/libtpm/tpm_drivers.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libtpm/tpm_drivers.c b/lib/libtpm/tpm_drivers.c
index 0e13561..85cb309 100644
--- a/lib/libtpm/tpm_drivers.c
+++ b/lib/libtpm/tpm_drivers.c
@@ -357,8 +357,7 @@ static bool spapr_vtpm_senddata(const uint8_t *const data, uint32_t len)
static bool spapr_vtpm_waitresponseready(enum tpm_duration_type to_t)
{
- uint32_t timeout = tpm2_durations[to_t];
- int i;
+ uint32_t i, timeout = tpm2_durations[to_t];
if (vtpm_drv_error_get() != VTPM_DRV_ERROR_NO_FAILURE) {
printf("%s: VTPM CRQ: In failure mode\n", __func__);
@@ -426,6 +425,8 @@ int spapr_transmit(uint8_t locty, struct tpm_req_header *req,
void *respbuffer, uint32_t *respbufferlen,
enum tpm_duration_type to_t)
{
+ if (locty)
+ return -1;
if (!spapr_vtpm_senddata((uint8_t *)req, be32_to_cpu(req->totlen)) ||
!spapr_vtpm_waitresponseready(to_t) ||
!spapr_vtpm_readresponse(respbuffer, respbufferlen) ||