[ISAPNP] Use pool tagging

This commit is contained in:
Dmitry Borisov 2021-03-04 18:43:19 +06:00
parent 8f44930f91
commit 66c195755c
4 changed files with 11 additions and 17 deletions

View file

@ -531,12 +531,10 @@ ProbeIsaPnpBus(
{ {
for (LogDev = 0; LogDev <= 0xFF; LogDev++) for (LogDev = 0; LogDev <= 0xFF; LogDev++)
{ {
LogDevice = ExAllocatePool(NonPagedPool, sizeof(ISAPNP_LOGICAL_DEVICE)); LogDevice = ExAllocatePoolZero(NonPagedPool, sizeof(ISAPNP_LOGICAL_DEVICE), TAG_ISAPNP);
if (!LogDevice) if (!LogDevice)
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
RtlZeroMemory(LogDevice, sizeof(ISAPNP_LOGICAL_DEVICE));
LogDevice->CSN = Csn; LogDevice->CSN = Csn;
LogDevice->LDN = LogDev; LogDevice->LDN = LogDev;
@ -548,7 +546,7 @@ ProbeIsaPnpBus(
if (Identifier.VendorId & 0x80) if (Identifier.VendorId & 0x80)
{ {
ExFreePool(LogDevice); ExFreePoolWithTag(LogDevice, TAG_ISAPNP);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }

View file

@ -192,11 +192,10 @@ IsaPnpCreateLogicalDeviceRequirements(
/* Allocate memory to store requirements */ /* Allocate memory to store requirements */
ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST)
+ ResourceCount * sizeof(IO_RESOURCE_DESCRIPTOR); + ResourceCount * sizeof(IO_RESOURCE_DESCRIPTOR);
RequirementsList = ExAllocatePool(PagedPool, ListSize); RequirementsList = ExAllocatePoolZero(PagedPool, ListSize, TAG_ISAPNP);
if (!RequirementsList) if (!RequirementsList)
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
RtlZeroMemory(RequirementsList, ListSize);
RequirementsList->ListSize = ListSize; RequirementsList->ListSize = ListSize;
RequirementsList->InterfaceType = Isa; RequirementsList->InterfaceType = Isa;
RequirementsList->AlternativeLists = 1; RequirementsList->AlternativeLists = 1;
@ -347,11 +346,10 @@ IsaPnpCreateLogicalDeviceResources(
/* Allocate memory to store resources */ /* Allocate memory to store resources */
ListSize = sizeof(CM_RESOURCE_LIST) ListSize = sizeof(CM_RESOURCE_LIST)
+ (ResourceCount - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); + (ResourceCount - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
ResourceList = ExAllocatePool(PagedPool, ListSize); ResourceList = ExAllocatePoolZero(PagedPool, ListSize, TAG_ISAPNP);
if (!ResourceList) if (!ResourceList)
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
RtlZeroMemory(ResourceList, ListSize);
ResourceList->Count = 1; ResourceList->Count = 1;
ResourceList->List[0].InterfaceType = Isa; ResourceList->List[0].InterfaceType = Isa;
ResourceList->List[0].PartialResourceList.Version = 1; ResourceList->List[0].PartialResourceList.Version = 1;
@ -637,11 +635,10 @@ IsaPnpCreateReadPortDORequirements(
ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST)
+ 2 * RTL_NUMBER_OF(Ports) * sizeof(IO_RESOURCE_DESCRIPTOR); + 2 * RTL_NUMBER_OF(Ports) * sizeof(IO_RESOURCE_DESCRIPTOR);
RequirementsList = ExAllocatePool(PagedPool, ListSize); RequirementsList = ExAllocatePoolZero(PagedPool, ListSize, TAG_ISAPNP);
if (!RequirementsList) if (!RequirementsList)
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
RtlZeroMemory(RequirementsList, ListSize);
RequirementsList->ListSize = ListSize; RequirementsList->ListSize = ListSize;
RequirementsList->AlternativeLists = 1; RequirementsList->AlternativeLists = 1;
@ -687,11 +684,10 @@ IsaPnpCreateReadPortDOResources(
ListSize = sizeof(CM_RESOURCE_LIST) + ListSize = sizeof(CM_RESOURCE_LIST) +
sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * (RTL_NUMBER_OF(Ports) - 1); sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * (RTL_NUMBER_OF(Ports) - 1);
ResourceList = ExAllocatePool(PagedPool, ListSize); ResourceList = ExAllocatePoolZero(PagedPool, ListSize, TAG_ISAPNP);
if (!ResourceList) if (!ResourceList)
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
RtlZeroMemory(ResourceList, ListSize);
ResourceList->Count = 1; ResourceList->Count = 1;
ResourceList->List[0].InterfaceType = Internal; ResourceList->List[0].InterfaceType = Internal;
ResourceList->List[0].PartialResourceList.Version = 1; ResourceList->List[0].PartialResourceList.Version = 1;

View file

@ -17,7 +17,7 @@
extern "C" { extern "C" {
#endif #endif
#define TAG_ISAPNP 'PNPI' #define TAG_ISAPNP 'pasI'
typedef enum typedef enum
{ {

View file

@ -29,7 +29,7 @@ IsaPdoQueryDeviceRelations(
if (IrpSp->Parameters.QueryDeviceRelations.Type != TargetDeviceRelation) if (IrpSp->Parameters.QueryDeviceRelations.Type != TargetDeviceRelation)
return Irp->IoStatus.Status; return Irp->IoStatus.Status;
DeviceRelations = ExAllocatePool(PagedPool, sizeof(*DeviceRelations)); DeviceRelations = ExAllocatePoolWithTag(PagedPool, sizeof(*DeviceRelations), TAG_ISAPNP);
if (!DeviceRelations) if (!DeviceRelations)
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
@ -127,7 +127,7 @@ IsaPdoQueryId(
if (!Source->Buffer) if (!Source->Buffer)
return Irp->IoStatus.Status; return Irp->IoStatus.Status;
Buffer = ExAllocatePool(PagedPool, Source->MaximumLength); Buffer = ExAllocatePoolWithTag(PagedPool, Source->MaximumLength, TAG_ISAPNP);
if (!Buffer) if (!Buffer)
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
@ -150,7 +150,7 @@ IsaPdoQueryResources(
return Irp->IoStatus.Status; return Irp->IoStatus.Status;
ListSize = PdoExt->ResourceListSize; ListSize = PdoExt->ResourceListSize;
ResourceList = ExAllocatePool(PagedPool, ListSize); ResourceList = ExAllocatePoolWithTag(PagedPool, ListSize, TAG_ISAPNP);
if (!ResourceList) if (!ResourceList)
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;
@ -173,7 +173,7 @@ IsaPdoQueryResourceRequirements(
return Irp->IoStatus.Status; return Irp->IoStatus.Status;
ListSize = PdoExt->RequirementsList->ListSize; ListSize = PdoExt->RequirementsList->ListSize;
RequirementsList = ExAllocatePool(PagedPool, ListSize); RequirementsList = ExAllocatePoolWithTag(PagedPool, ListSize, TAG_ISAPNP);
if (!RequirementsList) if (!RequirementsList)
return STATUS_NO_MEMORY; return STATUS_NO_MEMORY;