aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-04-18 17:01:02 -0400
committerKevin O'Connor <kevin@koconnor.net>2009-04-18 17:01:02 -0400
commit64cf2fba21df4c294fdc337aa6c603ccb51faf4a (patch)
tree354f88341c80a22b6e98aa7135044afd15f864de
parent38d1a349271731f100f0e4b3daa10cf601892591 (diff)
downloadseabios-64cf2fba21df4c294fdc337aa6c603ccb51faf4a.tar.gz
Try to prevent mapping option roms over flash.
Don't map an option rom in last 4MiB of ram or at its max.
-rw-r--r--src/optionroms.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/optionroms.c b/src/optionroms.c
index 841cae27..def3febb 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -214,7 +214,9 @@ map_optionrom(u16 bdf, u32 vendev)
if (!sz || sz == 0xffffffff)
goto fail;
- if (orig < 16*1024*1024) {
+ if (orig == sz || (u32)(orig + 4*1024*1024) < 20*1024*1024) {
+ // Don't try to map to a pci addresses at its max, in the last
+ // 4MiB of ram, or the first 16MiB of ram.
dprintf(6, "Preset rom address doesn't look valid\n");
goto fail;
}