device/ddr3: Prevent overflow when adding SMBUS Table 17 entries
Change-Id: If84c6849011106b2a50e504b79cda9cd6a3a9cc3 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/28588 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
parent
26036d9db3
commit
bb0ab9e531
|
@ -559,6 +559,12 @@ enum cb_err spd_add_smbios17(const u8 channel, const u8 slot,
|
||||||
memset(mem_info, 0, sizeof(*mem_info));
|
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];
|
dimm = &mem_info->dimm[mem_info->dimm_cnt];
|
||||||
if (info->size_mb) {
|
if (info->size_mb) {
|
||||||
dimm->ddr_type = MEMORY_TYPE_DDR3;
|
dimm->ddr_type = MEMORY_TYPE_DDR3;
|
||||||
|
|
Loading…
Reference in New Issue