soc/intel/skylake: Protect me_progress_rom_values array boundary

me_progress_rom_values array provides detailed information maps to ME
HFSTS2 register value.

There is a chance that ME status value might be over the size of
me_progress_rom_values.

This commit adds a check before access the array.

BUG=b:77247550

Change-Id: I5de569c62b94b0595d3d3ea254f50e312e8c11a4
Signed-off-by: Kane Chen <kane.chen@intel.com>
Reviewed-on: https://review.coreboot.org/25425
Reviewed-by: Kevin Chiu <Kevin.Chiu@quantatw.com>
Reviewed-by: Shelley Chen <shchen@google.com>
Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-by: Marc Jones <marc@marcjonesconsulting.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Kane Chen 2018-03-29 19:12:53 +08:00 committed by Shelley Chen
parent ba49c09b2f
commit 5b84fad5a9
1 changed files with 8 additions and 2 deletions

View File

@ -346,8 +346,14 @@ void intel_me_status(void)
printk(BIOS_DEBUG, "ME: Progress Phase State : "); printk(BIOS_DEBUG, "ME: Progress Phase State : ");
switch (hfs2.fields.progress_code) { switch (hfs2.fields.progress_code) {
case ME_HFS2_PHASE_ROM: /* ROM Phase */ case ME_HFS2_PHASE_ROM: /* ROM Phase */
if (hfs2.fields.current_state
< ARRAY_SIZE(me_progress_rom_values)
&& me_progress_rom_values[hfs2.fields.current_state])
printk(BIOS_DEBUG, "%s", printk(BIOS_DEBUG, "%s",
me_progress_rom_values[hfs2.fields.current_state]); me_progress_rom_values[
hfs2.fields.current_state]);
else
printk(BIOS_DEBUG, "0x%02x", hfs2.fields.current_state);
break; break;
case ME_HFS2_PHASE_UKERNEL: /* uKernel Phase */ case ME_HFS2_PHASE_UKERNEL: /* uKernel Phase */