Commit d94d9aa6 authored by Thierry Reding's avatar Thierry Reding Committed by Tom Rini
Browse files

pci: Add boundary check for hose->regions

Make sure that we don't overflow the hose->regions array, otherwise we
would end up overwriting the hose->region_count field and cause mayhem
to ensue. Also print an error message when we'd be overflowing because
it indicates that there aren't enough regions available and the number
needs to be increased.
Signed-off-by: default avatarThierry Reding <>
Reviewed-by: Simon Glass's avatarSimon Glass <>
parent 248b8735
......@@ -918,6 +918,11 @@ static void decode_regions(struct pci_controller *hose, ofnode parent_node,
for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
if (hose->region_count == MAX_PCI_REGIONS) {
pr_err("maximum number of regions parsed, aborting\n");
if (bd->bi_dram[i].size) {
pci_set_region(hose->regions + hose->region_count++,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment