summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlias Apalodimas <ilias.apalodimas@linaro.org>2021-05-26 21:01:00 +0300
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-05-28 16:17:01 +0200
commit38de680e582b36d4605b05d3b2c67a3c0c458bfb (patch)
treec1c7261da451e55f82b7985ec71c24f9bbedf635
parentaab8b17e94c447561a402bc7508b73fd8ee712e5 (diff)
downloadu-boot-38de680e582b36d4605b05d3b2c67a3c0c458bfb.tar.gz
u-boot-38de680e582b36d4605b05d3b2c67a3c0c458bfb.tar.xz
u-boot-38de680e582b36d4605b05d3b2c67a3c0c458bfb.zip
efi_loader: Fix coverity warnings for efi tcg2 protocol
Coverity reported 3 warnings on the current code. CID 331856, 331855, 331854 on the latest scan. Fix the rest of the warnings by initializing the variables before passing them to tpm2_get_pcr_info(). In order to avoid future warnings and errors initialize them to 0 within the function as well, since the values are always OR'ed after querying the hardware. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
-rw-r--r--lib/efi_loader/efi_tcg2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c
index 39074f7547..ee743f5951 100644
--- a/lib/efi_loader/efi_tcg2.c
+++ b/lib/efi_loader/efi_tcg2.c
@@ -403,6 +403,9 @@ static int tpm2_get_pcr_info(struct udevice *dev, u32 *supported_pcr,
size_t i;
int tpm_ret;
+ *supported_pcr = 0;
+ *active_pcr = 0;
+ *pcr_banks = 0;
memset(response, 0, sizeof(response));
ret = tpm2_get_capability(dev, TPM2_CAP_PCRS, 0, response, 1);
if (ret)
@@ -481,7 +484,7 @@ out:
static efi_status_t __get_active_pcr_banks(u32 *active_pcr_banks)
{
struct udevice *dev;
- u32 active, supported, pcr_banks;
+ u32 active = 0, supported = 0, pcr_banks = 0;
efi_status_t ret;
int err;
@@ -900,7 +903,7 @@ static efi_status_t create_specid_event(struct udevice *dev, void *buffer,
struct tcg_efi_spec_id_event *spec_event;
size_t spec_event_size;
efi_status_t ret = EFI_DEVICE_ERROR;
- u32 active, supported;
+ u32 active = 0, supported = 0;
int err;
size_t i;