mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
[NTOSKRNL]
- Fix a major off-by-one bug in resource conflict checking - Respect requested alignment when checking for valid port/memory ranges svn path=/trunk/; revision=54238
This commit is contained in:
parent
25eae4b916
commit
69fdb2ac71
1 changed files with 13 additions and 7 deletions
|
@ -47,7 +47,7 @@ IopFindBusNumberResource(
|
|||
ASSERT(IoDesc->Type == CmResourceTypeBusNumber);
|
||||
|
||||
for (Start = IoDesc->u.BusNumber.MinBusNumber;
|
||||
Start < IoDesc->u.BusNumber.MaxBusNumber;
|
||||
Start <= IoDesc->u.BusNumber.MaxBusNumber;
|
||||
Start++)
|
||||
{
|
||||
CmDesc->u.BusNumber.Length = IoDesc->u.BusNumber.Length;
|
||||
|
@ -78,9 +78,12 @@ IopFindMemoryResource(
|
|||
ASSERT(IoDesc->Type == CmDesc->Type);
|
||||
ASSERT(IoDesc->Type == CmResourceTypeMemory);
|
||||
|
||||
/* HACK */
|
||||
if (IoDesc->u.Memory.Alignment == 0) IoDesc->u.Memory.Alignment = 1;
|
||||
|
||||
for (Start = IoDesc->u.Memory.MinimumAddress.QuadPart;
|
||||
Start < IoDesc->u.Memory.MaximumAddress.QuadPart;
|
||||
Start++)
|
||||
Start <= IoDesc->u.Memory.MaximumAddress.QuadPart;
|
||||
Start += IoDesc->u.Memory.Alignment)
|
||||
{
|
||||
CmDesc->u.Memory.Length = IoDesc->u.Memory.Length;
|
||||
CmDesc->u.Memory.Start.QuadPart = Start;
|
||||
|
@ -110,10 +113,13 @@ IopFindPortResource(
|
|||
|
||||
ASSERT(IoDesc->Type == CmDesc->Type);
|
||||
ASSERT(IoDesc->Type == CmResourceTypePort);
|
||||
|
||||
/* HACK */
|
||||
if (IoDesc->u.Port.Alignment == 0) IoDesc->u.Port.Alignment = 1;
|
||||
|
||||
for (Start = IoDesc->u.Port.MinimumAddress.QuadPart;
|
||||
Start < IoDesc->u.Port.MaximumAddress.QuadPart;
|
||||
Start++)
|
||||
Start <= IoDesc->u.Port.MaximumAddress.QuadPart;
|
||||
Start += IoDesc->u.Port.Alignment)
|
||||
{
|
||||
CmDesc->u.Port.Length = IoDesc->u.Port.Length;
|
||||
CmDesc->u.Port.Start.QuadPart = Start;
|
||||
|
@ -143,7 +149,7 @@ IopFindDmaResource(
|
|||
ASSERT(IoDesc->Type == CmResourceTypeDma);
|
||||
|
||||
for (Channel = IoDesc->u.Dma.MinimumChannel;
|
||||
Channel < IoDesc->u.Dma.MaximumChannel;
|
||||
Channel <= IoDesc->u.Dma.MaximumChannel;
|
||||
Channel++)
|
||||
{
|
||||
CmDesc->u.Dma.Channel = Channel;
|
||||
|
@ -168,7 +174,7 @@ IopFindInterruptResource(
|
|||
ASSERT(IoDesc->Type == CmResourceTypeInterrupt);
|
||||
|
||||
for (Vector = IoDesc->u.Interrupt.MinimumVector;
|
||||
Vector < IoDesc->u.Interrupt.MaximumVector;
|
||||
Vector <= IoDesc->u.Interrupt.MaximumVector;
|
||||
Vector++)
|
||||
{
|
||||
CmDesc->u.Interrupt.Vector = Vector;
|
||||
|
|
Loading…
Reference in a new issue