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

Re: [Xen-devel] xen-unstable stubdom build-failure when debug=n



On Mon, Jul 21, Daniel De Graaf wrote:

> In that case, shouldn't the error be phrased less severely (something like 
> "might be
> below array bounds")?  Anyway, the actual value is checked by locality_enabled
> prior to the array access, and that check is effectively (0x1F & (1 << 
> locality)),
> limiting the actual value to 0..4.  I can't reproduce the warning with my 
> version
> of GCC, so I'm only looking at the code, but it looks like GCC is being overly
> conservative after not detecting the range limit and this is just a false 
> positive.

So how should we proceed here? Adjust the code to use unsigned array
indices, or drop support for gcc versions as shipped with sle11 (gcc 4.3)?
Of adjust the code like this:

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) {

Olaf

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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