gcc-4.3 fails to prove that array indices will remain positive. Add a
hint for the compiler and check the index value before using it.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
static int locality_enabled(struct tpm_chip* tpm, int l) {
- return tpm->enabled_localities & (1 << l);
+ return l >= 0 && tpm->enabled_localities & (1 << l);
}
static int check_locality(struct tpm_chip* tpm, int l) {