Author: tfaber
Date: Sat Aug 30 10:59:25 2014
New Revision: 63985
URL:
http://svn.reactos.org/svn/reactos?rev=63985&view=rev
Log:
[FREELDR]
- Improve GetPciIrqRoutingTable. Patch by Sergey Chernov (serrox at ya dot ru), small
modifications by me.
CORE-8440
Modified:
trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/hwpci.c [iso-8859-1] Sat Aug 30 10:59:25
2014
@@ -41,6 +41,14 @@
{
TRACE("Found signature\n");
+ if (Table->TableSize < FIELD_OFFSET(PCI_IRQ_ROUTING_TABLE, Slot) ||
+ Table->TableSize % 16 != 0)
+ {
+ ERR("Invalid routing table size (%u) at %p. Continue
searching...\n", Table->TableSize, Table);
+ Table = (PPCI_IRQ_ROUTING_TABLE)((ULONG_PTR)Table + 0x10);
+ continue;
+ }
+
Ptr = (PUCHAR)Table;
Sum = 0;
for (i = 0; i < Table->TableSize; i++)
@@ -50,17 +58,19 @@
if ((Sum & 0xFF) != 0)
{
- ERR("Invalid routing table\n");
- return NULL;
- }
-
- TRACE("Valid checksum\n");
-
- return Table;
+ ERR("Invalid routing table checksum (%#lx) at %p. Continue
searching...\n", Sum & 0xFF, Table);
+ }
+ else
+ {
+ TRACE("Valid checksum\n");
+ return Table;
+ }
}
Table = (PPCI_IRQ_ROUTING_TABLE)((ULONG_PTR)Table + 0x10);
}
+
+ ERR("No valid routing table found!\n");
return NULL;
}