mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-20 11:55:03 +00:00
tpm: add checker for pcr count
Add bound checking for pcr count before using it. Addresses-Coverity-ID: 541280: Insecure data handling (TAINTED_SCALAR) Addresses-Coverity-ID: 541281: Insecure data handling (TAINTED_SCALAR) Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
This commit is contained in:
parent
cfdf18b31b
commit
94a409c258
2 changed files with 6 additions and 0 deletions
|
@ -304,6 +304,9 @@ static int do_tpm2_pcrallocate(struct cmd_tbl *cmdtp, int flag, int argc,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (pcr.count > TPM2_NUM_PCR_BANKS)
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < pcr.count; i++) {
|
||||
struct tpms_pcr_selection *sel = &pcr.selection[i];
|
||||
const char *name;
|
||||
|
|
|
@ -74,6 +74,9 @@ int tpm2_scan_masks(struct udevice *dev, u32 log_active, u32 *mask)
|
|||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (pcrs.count > TPM2_NUM_PCR_BANKS)
|
||||
return TPM_LIB_ERROR;
|
||||
|
||||
for (i = 0; i < pcrs.count; i++) {
|
||||
struct tpms_pcr_selection *sel = &pcrs.selection[i];
|
||||
size_t j;
|
||||
|
|
Loading…
Add table
Reference in a new issue