Try to prevent mapping option roms over flash.
authorKevin O'Connor <kevin@koconnor.net>
Sat, 18 Apr 2009 21:01:02 +0000 (17:01 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 18 Apr 2009 21:01:02 +0000 (17:01 -0400)
Don't map an option rom in last 4MiB of ram or at its max.

src/optionroms.c

index 841cae27e472e4638ed2beaecefcac16584b6aa6..def3febb457c9fa1d6cd8f5124f521a1ae169a01 100644 (file)
@@ -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;
     }