mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 18:25:52 +00:00
- Free memory using a valid tag
- Don't use a hardcoded constant for pointer size - Don't access invalid memory when an SCI is absent (fixes ASSERT(Descriptor->u.Interrupt.MinimumVector == Descriptor->u.Interrupt.MaximumVector) failure) - Remove unreachable code svn path=/trunk/; revision=53275
This commit is contained in:
parent
3d143c0ab0
commit
3c5d660a3d
2 changed files with 28 additions and 37 deletions
|
@ -1002,7 +1002,7 @@ HalpQueryAcpiResourceRequirements(OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requiremen
|
|||
else
|
||||
{
|
||||
/* Fail */
|
||||
ExFreePoolWithTag(RequirementsList, 0);
|
||||
ExFreePoolWithTag(RequirementsList, ' laH');
|
||||
Status = STATUS_NO_SUCH_DEVICE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject,
|
|||
FdoRelations = ExAllocatePoolWithTag(PagedPool,
|
||||
FIELD_OFFSET(DEVICE_RELATIONS,
|
||||
Objects) +
|
||||
4 * PdoCount,
|
||||
sizeof(PDEVICE_OBJECT) * PdoCount,
|
||||
' laH');
|
||||
if (!FdoRelations) return STATUS_INSUFFICIENT_RESOURCES;
|
||||
|
||||
|
@ -220,7 +220,7 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject,
|
|||
}
|
||||
|
||||
/* Free existing structure */
|
||||
ExFreePoolWithTag(*DeviceRelations, 0);
|
||||
ExFreePool(*DeviceRelations);
|
||||
}
|
||||
|
||||
/* Now check if we have a PDO list */
|
||||
|
@ -359,7 +359,7 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
/* Fail, no memory */
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
ExFreePoolWithTag(RequirementsList, 0);
|
||||
ExFreePoolWithTag(RequirementsList, ' laH');
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -372,25 +372,20 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject,
|
|||
ResourceList->List[0].InterfaceType = PNPBus;
|
||||
ResourceList->List[0].PartialResourceList.Version = 1;
|
||||
ResourceList->List[0].PartialResourceList.Revision = 1;
|
||||
ResourceList->List[0].PartialResourceList.Count = 1;
|
||||
ResourceList->List[0].PartialResourceList.Count = 0;
|
||||
|
||||
/* Setup the first descriptor */
|
||||
PartialDesc = ResourceList->List[0].PartialResourceList.PartialDescriptors;
|
||||
PartialDesc->Type = CmResourceTypeInterrupt;
|
||||
|
||||
/* Find the requirement descriptor for the SCI */
|
||||
for (i = 0; i < RequirementsList->List[0].Count; i++)
|
||||
{
|
||||
/* Get this descriptor */
|
||||
Descriptor = &RequirementsList->List[0].Descriptors[i];
|
||||
if (Descriptor->Type == CmResourceTypeInterrupt) break;
|
||||
Descriptor = NULL;
|
||||
}
|
||||
|
||||
/* Make sure we found the descriptor */
|
||||
if (Descriptor)
|
||||
if (Descriptor->Type == CmResourceTypeInterrupt)
|
||||
{
|
||||
/* Copy requirements descriptor into resource descriptor */
|
||||
PartialDesc->Type = CmResourceTypeInterrupt;
|
||||
PartialDesc->ShareDisposition = Descriptor->ShareDisposition;
|
||||
PartialDesc->Flags = Descriptor->Flags;
|
||||
ASSERT(Descriptor->u.Interrupt.MinimumVector ==
|
||||
|
@ -399,16 +394,18 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject,
|
|||
PartialDesc->u.Interrupt.Level = Descriptor->u.Interrupt.MinimumVector;
|
||||
PartialDesc->u.Interrupt.Affinity = 0xFFFFFFFF;
|
||||
|
||||
/* Return resources and success */
|
||||
*Resources = ResourceList;
|
||||
ExFreePoolWithTag(RequirementsList, 0);
|
||||
return STATUS_SUCCESS;
|
||||
ResourceList->List[0].PartialResourceList.Count++;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Free memory and fail */
|
||||
ExFreePoolWithTag(RequirementsList, 0);
|
||||
ExFreePoolWithTag(ResourceList, 0);
|
||||
Status = STATUS_NOT_FOUND;
|
||||
/* Return resources and success */
|
||||
*Resources = ResourceList;
|
||||
|
||||
ExFreePoolWithTag(RequirementsList, ' laH');
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
else if (DeviceExtension->PdoType == WdPdo)
|
||||
{
|
||||
|
@ -420,9 +417,6 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject,
|
|||
/* This shouldn't happen */
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Return the status */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
@ -450,9 +444,6 @@ HalpQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject,
|
|||
/* This shouldn't happen */
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
/* Return the status */
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue