Martin Roth (martinroth@google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/12781
-gerrit
commit 9ba3b934b670e678639f2931399bdf2aaad70713 Author: Martin Roth martinroth@google.com Date: Mon Dec 21 13:14:58 2015 -0700
soc/intel/fsp_baytrail: Make sure i2c bus is < 7
Baytrail has I2c Busses 0 to 6, so is supposed to error out if the I2c driver is called with 7 or greater. Due to an off-by-one error it could be called with bus 7.
Fixes coverity warning: CID 1287074 (#1 of 1): Out-of-bounds read (OVERRUN) 3. overrun-local: Overrunning array base_adr of 7 4-byte elements at element index 7 (byte offset 28) using index bus (which evaluates to 7).
Change-Id: I7caec60298cf27bd669796e0e05e4a896f92befd Signed-off-by: Martin Roth martinroth@google.com --- src/soc/intel/fsp_baytrail/i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/soc/intel/fsp_baytrail/i2c.c b/src/soc/intel/fsp_baytrail/i2c.c index 6cf07a4..c6c8f65 100644 --- a/src/soc/intel/fsp_baytrail/i2c.c +++ b/src/soc/intel/fsp_baytrail/i2c.c @@ -102,7 +102,7 @@ int i2c_init(unsigned bus) I2C6_MEM_BASE}; char *base_ptr; /* Ensure the desired device is valid */ - if (bus > ARRAY_SIZE(base_adr)) { + if (bus >= ARRAY_SIZE(base_adr)) { printk(BIOS_ERR, "I2C: Only I2C controllers 0...6 are available.\n"); return I2C_ERR; }