summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2022-10-25 19:01:49 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-10-26 22:09:39 +0000
commitec69bdcd2fb7e2e39a5e61d3eece202291496afb (patch)
tree8e77eaf31120a77f45f541e7dc6981e3865834ed /src
parent3ad216be1de41e37de0d0decddee28241736970a (diff)
mb/amd/mandolin: handle invalid intr_index values in init_tables
Make sure that the intr_index is valid to avoid out-of-bounds writes to the fch_pic_routing and fch_apic_routing arrays. Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I45ab115f3814b212243c4f6cf706daf77b6ff3b2 Reviewed-on: https://review.coreboot.org/c/coreboot/+/68848 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/mainboard/amd/mandolin/mainboard.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mainboard/amd/mandolin/mainboard.c b/src/mainboard/amd/mandolin/mainboard.c
index 1eb3329d13..397179a68a 100644
--- a/src/mainboard/amd/mandolin/mainboard.c
+++ b/src/mainboard/amd/mandolin/mainboard.c
@@ -69,6 +69,12 @@ static void init_tables(void)
memset(fch_apic_routing, PIRQ_NC, sizeof(fch_apic_routing));
for (i = 0; i < mb_fch_irq_mapping_table_size; i++) {
+ if (mb_irq_map[i].intr_index >= FCH_IRQ_ROUTING_ENTRIES) {
+ printk(BIOS_WARNING,
+ "Invalid IRQ index %u in FCH IRQ routing table entry %zu\n",
+ mb_irq_map[i].intr_index, i);
+ continue;
+ }
fch_pic_routing[mb_irq_map[i].intr_index] = mb_irq_map[i].pic_irq_num;
fch_apic_routing[mb_irq_map[i].intr_index] = mb_irq_map[i].apic_irq_num;
}