[coreboot-gerrit] New patch to review for coreboot: nb/intel/i82810: Make sure DIMM size isn't negative

Martin Roth (martinroth@google.com) gerrit at coreboot.org
Fri Nov 18 20:25:48 CET 2016


Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17485

-gerrit

commit d87c98ae3d7d2c22edb76dd9f4a113e35325561b
Author: Martin Roth <martinroth at google.com>
Date:   Fri Nov 18 08:56:10 2016 -0700

    nb/intel/i82810: Make sure DIMM size isn't negative
    
    If smbus_read_byte returned an error when reading the DIMM size,
    this value would be used as an offset into an array.
    
    Check for the error, and set the DIMM size to 0 if there's
    a problem.
    
    Addresses coverity issue 1229658 - Negative array index read
    
    Signed-off-by: Martin Roth <martinroth at google.com>
    Change-Id: I6461a0fae819dd9261adbb411c4bba07520d076d
---
 src/northbridge/intel/i82810/raminit.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/northbridge/intel/i82810/raminit.c b/src/northbridge/intel/i82810/raminit.c
index 83ef883..0c6a2a7 100644
--- a/src/northbridge/intel/i82810/raminit.c
+++ b/src/northbridge/intel/i82810/raminit.c
@@ -240,6 +240,10 @@ static void spd_set_dram_size(void)
 				printk
 				    (BIOS_ERR, "Attempting to treat as 128MB DIMM\n");
 				dimm_size = 32;
+			} else if (dimm_size < 0) {
+				/* On smbus error, set DIMM size to 0 */
+				printk(BIOS_ERR, "Error reading DIMM size\n");
+				dimm_size = 0;
 			}
 
 			/* This array is provided in raminit.h, because it got



More information about the coreboot-gerrit mailing list