Author: cgutman
Date: Wed Aug 17 05:55:43 2011
New Revision: 53275
URL:
http://svn.reactos.org/svn/reactos?rev=53275&view=rev
Log:
- 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
Modified:
trunk/reactos/hal/halx86/generic/acpi/halacpi.c
trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c
Modified: trunk/reactos/hal/halx86/generic/acpi/halacpi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/acpi/ha…
==============================================================================
--- trunk/reactos/hal/halx86/generic/acpi/halacpi.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/acpi/halacpi.c [iso-8859-1] Wed Aug 17 05:55:43 2011
@@ -1002,7 +1002,7 @@
else
{
/* Fail */
- ExFreePoolWithTag(RequirementsList, 0);
+ ExFreePoolWithTag(RequirementsList, ' laH');
Status = STATUS_NO_SUCH_DEVICE;
}
}
Modified: trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/acpi/ha…
==============================================================================
--- trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c [iso-8859-1] Wed Aug 17 05:55:43
2011
@@ -196,7 +196,7 @@
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 @@
}
/* Free existing structure */
- ExFreePoolWithTag(*DeviceRelations, 0);
+ ExFreePool(*DeviceRelations);
}
/* Now check if we have a PDO list */
@@ -359,7 +359,7 @@
{
/* Fail, no memory */
Status = STATUS_INSUFFICIENT_RESOURCES;
- ExFreePoolWithTag(RequirementsList, 0);
+ ExFreePoolWithTag(RequirementsList, ' laH');
return Status;
}
@@ -372,43 +372,40 @@
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;
+ 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 ==
+ Descriptor->u.Interrupt.MaximumVector);
+ PartialDesc->u.Interrupt.Vector =
Descriptor->u.Interrupt.MinimumVector;
+ PartialDesc->u.Interrupt.Level =
Descriptor->u.Interrupt.MinimumVector;
+ PartialDesc->u.Interrupt.Affinity = 0xFFFFFFFF;
+
+ ResourceList->List[0].PartialResourceList.Count++;
+
+ break;
+ }
}
-
- /* Make sure we found the descriptor */
- if (Descriptor)
- {
- /* Copy requirements descriptor into resource descriptor */
- PartialDesc->ShareDisposition = Descriptor->ShareDisposition;
- PartialDesc->Flags = Descriptor->Flags;
- ASSERT(Descriptor->u.Interrupt.MinimumVector ==
- Descriptor->u.Interrupt.MaximumVector);
- PartialDesc->u.Interrupt.Vector =
Descriptor->u.Interrupt.MinimumVector;
- 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;
- }
-
- /* 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 @@
/* This shouldn't happen */
return STATUS_UNSUCCESSFUL;
}
-
- /* Return the status */
- return Status;
}
NTSTATUS
@@ -450,9 +444,6 @@
/* This shouldn't happen */
return STATUS_UNSUCCESSFUL;
}
-
- /* Return the status */
- return Status;
}
NTSTATUS