soc/intel/meminit: Check array size
Work around a GCC LTO bug. Even if no buffer overflow is bound to happen as the soldered down path is taken GCC LTO complains about this. Change-Id: Ib3d4ed8032bb06b6d08fbc2dc4b697df88745243 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/84205 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
parent
735ca7f24a
commit
5d03b1d216
1 changed files with 5 additions and 2 deletions
|
|
@ -115,8 +115,9 @@ static bool read_spd_dimm(FSPM_UPD *memupd, const struct soc_mem_cfg *soc_mem_cf
|
|||
|
||||
for (ch = 0; ch < num_phys_ch; ch++) {
|
||||
for (dimm = 0; dimm < CONFIG_DIMMS_PER_CHANNEL; dimm++) {
|
||||
blk.addr_map[CH_DIMM_OFFSET(ch, dimm)] =
|
||||
info->smbus[ch].addr_dimm[dimm];
|
||||
if (CH_DIMM_OFFSET(ch, dimm) < ARRAY_SIZE(blk.addr_map))
|
||||
blk.addr_map[CH_DIMM_OFFSET(ch, dimm)] =
|
||||
info->smbus[ch].addr_dimm[dimm];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -167,6 +168,8 @@ static bool read_spd_dimm(FSPM_UPD *memupd, const struct soc_mem_cfg *soc_mem_cf
|
|||
size_t mrc_ch = soc_mem_cfg->phys_to_mrc_map[ch];
|
||||
|
||||
for (dimm = 0; dimm < CONFIG_DIMMS_PER_CHANNEL; dimm++) {
|
||||
if (!(CH_DIMM_OFFSET(ch, dimm) < ARRAY_SIZE(blk.spd_array)))
|
||||
continue;
|
||||
uint8_t *spd_data = blk.spd_array[CH_DIMM_OFFSET(ch, dimm)];
|
||||
if (spd_data == NULL)
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue