[coreboot-gerrit] Change in coreboot[master]: device/ddr3: Prevent overflow when adding SMBUS Table 17 entries

Felix Held (Code Review) gerrit at coreboot.org
Fri Sep 14 22:16:48 CEST 2018


Felix Held has submitted this change and it was merged. ( https://review.coreboot.org/28588 )

Change subject: device/ddr3: Prevent overflow when adding SMBUS Table 17 entries
......................................................................

device/ddr3: Prevent overflow when adding SMBUS Table 17 entries

Change-Id: If84c6849011106b2a50e504b79cda9cd6a3a9cc3
Signed-off-by: Nico Huber <nico.huber at secunet.com>
Reviewed-on: https://review.coreboot.org/28588
Tested-by: build bot (Jenkins) <no-reply at coreboot.org>
Reviewed-by: Patrick Rudolph <siro at das-labor.org>
---
M src/device/dram/ddr3.c
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  build bot (Jenkins): Verified
  Patrick Rudolph: Looks good to me, approved



diff --git a/src/device/dram/ddr3.c b/src/device/dram/ddr3.c
index 63ca964..f27fdcb 100644
--- a/src/device/dram/ddr3.c
+++ b/src/device/dram/ddr3.c
@@ -559,6 +559,12 @@
 		memset(mem_info, 0, sizeof(*mem_info));
 	}
 
+	if (mem_info->dimm_cnt >= ARRAY_SIZE(mem_info->dimm)) {
+		printk(BIOS_WARNING, "BUG: Too many DIMM infos for %s.\n",
+			__func__);
+		return CB_ERR;
+	}
+
 	dimm = &mem_info->dimm[mem_info->dimm_cnt];
 	if (info->size_mb) {
 		dimm->ddr_type = MEMORY_TYPE_DDR3;

-- 
To view, visit https://review.coreboot.org/28588
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If84c6849011106b2a50e504b79cda9cd6a3a9cc3
Gerrit-Change-Number: 28588
Gerrit-PatchSet: 2
Gerrit-Owner: Nico Huber <nico.h at gmx.de>
Gerrit-Reviewer: Felix Held <felix-coreboot at felixheld.de>
Gerrit-Reviewer: Patrick Rudolph <siro at das-labor.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply at coreboot.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180914/88524192/attachment.html>


More information about the coreboot-gerrit mailing list