[NTOSKRNL]
[reactos.git] / reactos / ntoskrnl / mm / ARM3 / expool.c
index ff1b2b2..a5f0818 100644 (file)
@@ -358,7 +358,7 @@ ExpComputeHashForTag(IN ULONG Tag,
     // Finally, AND with the bucket mask to generate a valid index/bucket into
     // the table
     //
-    ULONGLONG Result = 40543 * Tag;
+    ULONGLONG Result = (ULONGLONG)40543 * Tag;
     return (ULONG)BucketMask & ((ULONG)Result ^ (Result >> 32));
 }
 
@@ -1185,7 +1185,7 @@ ExGetPoolTagInfo(IN PSYSTEM_POOLTAG_INFORMATION SystemInformation,
     //
     // Free the "Generic DPC" temporary buffer, return the buffer length and status
     //
-    ExFreePool(Buffer);
+    ExFreePoolWithTag(Buffer, 'ofnI');
     if (ReturnLength) *ReturnLength = CurrentLength;
     return Status;
 }
@@ -1583,6 +1583,7 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
     //
     i = (USHORT)((NumberOfBytes + sizeof(POOL_HEADER) + (POOL_BLOCK_SIZE - 1))
                  / POOL_BLOCK_SIZE);
+    ASSERT(i < POOL_LISTS_PER_PAGE);
 
     //
     // Handle lookaside list optimization for both paged and nonpaged pool
@@ -1664,7 +1665,6 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
                 // Try again!
                 //
                 ExUnlockPool(PoolDesc, OldIrql);
-                ListHead++;
                 continue;
             }
 
@@ -2150,6 +2150,15 @@ ExFreePoolWithTag(IN PVOID P,
                          BlockSize * POOL_BLOCK_SIZE,
                          Entry->PoolType - 1);
 
+    //
+    // Check block tag
+    //
+    if (TagToFree && TagToFree != Tag)
+    {
+        DPRINT1("Freeing pool - invalid tag specified: %.4s != %.4s\n", (char*)&TagToFree, (char*)&Tag);
+        KeBugCheckEx(BAD_POOL_CALLER, 0x0A, (ULONG_PTR)P, Tag, TagToFree);
+    }
+
     //
     // Is this allocation small enough to have come from a lookaside list?
     //
@@ -2200,15 +2209,6 @@ ExFreePoolWithTag(IN PVOID P,
     //
     OldIrql = ExLockPool(PoolDesc);
 
-    //
-    // Check block tag
-    //
-    if (TagToFree && TagToFree != Entry->PoolTag)
-    {
-        DPRINT1("Freeing pool - invalid tag specified: %.4s != %.4s\n", (char*)&TagToFree, (char*)&Entry->PoolTag);
-        KeBugCheckEx(BAD_POOL_CALLER, 0x0A, (ULONG_PTR)P, Entry->PoolTag, TagToFree);
-    }
-
     //
     // Check if the next allocation is at the end of the page
     //