Re: [PATCH 2/2] ima: support calculating the boot_aggregate based on different TPM banks

From: Lakshmi Ramasubramanian
Date: Mon Jan 27 2020 - 11:50:12 EST


On 1/27/2020 8:01 AM, Mimi Zohar wrote:

+
+ for (i = 0; i < ima_tpm_chip->nr_allocated_banks; i++) {
+ if (ima_tpm_chip->allocated_banks[i].alg_id == d.alg_id)
+ break;
+ }
+
+ if (i == ima_tpm_chip->nr_allocated_banks)
+ d.alg_id = ima_tpm_chip->allocated_banks[0].alg_id;
+

Can the number of allocated banks (ima_tpm_chip->nr_allocated_banks) be zero? Should that be checked before accessing "allocated_banks"?

-lakshmi