[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] mini-os: tpm: fix array access in locality_enabled



commit 52bdfeacbb601da2d66b5b1dde159b973ee8b309
Author:     Olaf Hering <olaf@xxxxxxxxx>
AuthorDate: Tue Jul 22 09:19:15 2014 +0200
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Thu Jul 24 16:23:18 2014 +0100

    mini-os: tpm: fix array access in locality_enabled
    
    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@xxxxxxxxx>
    Acked-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
---
 extras/mini-os/tpm_tis.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/extras/mini-os/tpm_tis.c b/extras/mini-os/tpm_tis.c
index e8ca69f..dc4134a 100644
--- a/extras/mini-os/tpm_tis.c
+++ b/extras/mini-os/tpm_tis.c
@@ -611,7 +611,7 @@ s_time_t tpm_calc_ordinal_duration(struct tpm_chip *chip,
 
 
 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) {
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.