https://git.reactos.org/?p=reactos.git;a=commitdiff;h=66c195755c14a7d66b5b50f749d8188ef0a2f276

commit 66c195755c14a7d66b5b50f749d8188ef0a2f276
Author:     Dmitry Borisov <[email protected]>
AuthorDate: Thu Mar 4 18:43:19 2021 +0600
Commit:     Dmitry Borisov <[email protected]>
CommitDate: Sun Jun 20 19:22:31 2021 +0600

    [ISAPNP] Use pool tagging
---
 drivers/bus/isapnp/hardware.c |  6 ++----
 drivers/bus/isapnp/isapnp.c   | 12 ++++--------
 drivers/bus/isapnp/isapnp.h   |  2 +-
 drivers/bus/isapnp/pdo.c      |  8 ++++----
 4 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/bus/isapnp/hardware.c b/drivers/bus/isapnp/hardware.c
index 5c016902d5b..d9146f15754 100644
--- a/drivers/bus/isapnp/hardware.c
+++ b/drivers/bus/isapnp/hardware.c
@@ -531,12 +531,10 @@ ProbeIsaPnpBus(
     {
         for (LogDev = 0; LogDev <= 0xFF; LogDev++)
         {
-            LogDevice = ExAllocatePool(NonPagedPool, 
sizeof(ISAPNP_LOGICAL_DEVICE));
+            LogDevice = ExAllocatePoolZero(NonPagedPool, 
sizeof(ISAPNP_LOGICAL_DEVICE), TAG_ISAPNP);
             if (!LogDevice)
                 return STATUS_NO_MEMORY;
 
-            RtlZeroMemory(LogDevice, sizeof(ISAPNP_LOGICAL_DEVICE));
-
             LogDevice->CSN = Csn;
             LogDevice->LDN = LogDev;
 
@@ -548,7 +546,7 @@ ProbeIsaPnpBus(
 
             if (Identifier.VendorId & 0x80)
             {
-                ExFreePool(LogDevice);
+                ExFreePoolWithTag(LogDevice, TAG_ISAPNP);
                 return STATUS_SUCCESS;
             }
 
diff --git a/drivers/bus/isapnp/isapnp.c b/drivers/bus/isapnp/isapnp.c
index 784119502de..56ea50d379d 100644
--- a/drivers/bus/isapnp/isapnp.c
+++ b/drivers/bus/isapnp/isapnp.c
@@ -192,11 +192,10 @@ IsaPnpCreateLogicalDeviceRequirements(
     /* Allocate memory to store requirements */
     ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST)
                + ResourceCount * sizeof(IO_RESOURCE_DESCRIPTOR);
-    RequirementsList = ExAllocatePool(PagedPool, ListSize);
+    RequirementsList = ExAllocatePoolZero(PagedPool, ListSize, TAG_ISAPNP);
     if (!RequirementsList)
         return STATUS_NO_MEMORY;
 
-    RtlZeroMemory(RequirementsList, ListSize);
     RequirementsList->ListSize = ListSize;
     RequirementsList->InterfaceType = Isa;
     RequirementsList->AlternativeLists = 1;
@@ -347,11 +346,10 @@ IsaPnpCreateLogicalDeviceResources(
     /* Allocate memory to store resources */
     ListSize = sizeof(CM_RESOURCE_LIST)
                + (ResourceCount - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR);
-    ResourceList = ExAllocatePool(PagedPool, ListSize);
+    ResourceList = ExAllocatePoolZero(PagedPool, ListSize, TAG_ISAPNP);
     if (!ResourceList)
         return STATUS_NO_MEMORY;
 
-    RtlZeroMemory(ResourceList, ListSize);
     ResourceList->Count = 1;
     ResourceList->List[0].InterfaceType = Isa;
     ResourceList->List[0].PartialResourceList.Version = 1;
@@ -637,11 +635,10 @@ IsaPnpCreateReadPortDORequirements(
 
     ListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST)
                + 2 * RTL_NUMBER_OF(Ports) * sizeof(IO_RESOURCE_DESCRIPTOR);
-    RequirementsList = ExAllocatePool(PagedPool, ListSize);
+    RequirementsList = ExAllocatePoolZero(PagedPool, ListSize, TAG_ISAPNP);
     if (!RequirementsList)
         return STATUS_NO_MEMORY;
 
-    RtlZeroMemory(RequirementsList, ListSize);
     RequirementsList->ListSize = ListSize;
     RequirementsList->AlternativeLists = 1;
 
@@ -687,11 +684,10 @@ IsaPnpCreateReadPortDOResources(
 
     ListSize = sizeof(CM_RESOURCE_LIST) +
                sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * (RTL_NUMBER_OF(Ports) 
- 1);
-    ResourceList = ExAllocatePool(PagedPool, ListSize);
+    ResourceList = ExAllocatePoolZero(PagedPool, ListSize, TAG_ISAPNP);
     if (!ResourceList)
         return STATUS_NO_MEMORY;
 
-    RtlZeroMemory(ResourceList, ListSize);
     ResourceList->Count = 1;
     ResourceList->List[0].InterfaceType = Internal;
     ResourceList->List[0].PartialResourceList.Version = 1;
diff --git a/drivers/bus/isapnp/isapnp.h b/drivers/bus/isapnp/isapnp.h
index 9d339f2f0d4..e9b003b325b 100644
--- a/drivers/bus/isapnp/isapnp.h
+++ b/drivers/bus/isapnp/isapnp.h
@@ -17,7 +17,7 @@
 extern "C" {
 #endif
 
-#define TAG_ISAPNP 'PNPI'
+#define TAG_ISAPNP 'pasI'
 
 typedef enum
 {
diff --git a/drivers/bus/isapnp/pdo.c b/drivers/bus/isapnp/pdo.c
index c8a86ed76f0..57c217f200e 100644
--- a/drivers/bus/isapnp/pdo.c
+++ b/drivers/bus/isapnp/pdo.c
@@ -29,7 +29,7 @@ IsaPdoQueryDeviceRelations(
     if (IrpSp->Parameters.QueryDeviceRelations.Type != TargetDeviceRelation)
         return Irp->IoStatus.Status;
 
-    DeviceRelations = ExAllocatePool(PagedPool, sizeof(*DeviceRelations));
+    DeviceRelations = ExAllocatePoolWithTag(PagedPool, 
sizeof(*DeviceRelations), TAG_ISAPNP);
     if (!DeviceRelations)
         return STATUS_NO_MEMORY;
 
@@ -127,7 +127,7 @@ IsaPdoQueryId(
     if (!Source->Buffer)
         return Irp->IoStatus.Status;
 
-    Buffer = ExAllocatePool(PagedPool, Source->MaximumLength);
+    Buffer = ExAllocatePoolWithTag(PagedPool, Source->MaximumLength, 
TAG_ISAPNP);
     if (!Buffer)
         return STATUS_NO_MEMORY;
 
@@ -150,7 +150,7 @@ IsaPdoQueryResources(
         return Irp->IoStatus.Status;
 
     ListSize = PdoExt->ResourceListSize;
-    ResourceList = ExAllocatePool(PagedPool, ListSize);
+    ResourceList = ExAllocatePoolWithTag(PagedPool, ListSize, TAG_ISAPNP);
     if (!ResourceList)
         return STATUS_NO_MEMORY;
 
@@ -173,7 +173,7 @@ IsaPdoQueryResourceRequirements(
         return Irp->IoStatus.Status;
 
     ListSize = PdoExt->RequirementsList->ListSize;
-    RequirementsList = ExAllocatePool(PagedPool, ListSize);
+    RequirementsList = ExAllocatePoolWithTag(PagedPool, ListSize, TAG_ISAPNP);
     if (!RequirementsList)
         return STATUS_NO_MEMORY;
 

Reply via email to