diff options
-rw-r--r-- | src/device/dram/ddr3.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/device/dram/ddr3.c b/src/device/dram/ddr3.c index 63ca964a5a..f27fdcb1e0 100644 --- a/src/device/dram/ddr3.c +++ b/src/device/dram/ddr3.c @@ -559,6 +559,12 @@ enum cb_err spd_add_smbios17(const u8 channel, const u8 slot, 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; |