mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 06:26:35 +00:00
- Add several missing assertions documented on the MSDN page "Checked Build ASSERTs"
- Fix a typo in MmProbeAndLockPages; assignment within an ASSERT isn't such a good idea! (was harmless though) svn path=/trunk/; revision=43653
This commit is contained in:
parent
fd33db1896
commit
ca9d484be7
6 changed files with 57 additions and 6 deletions
|
@ -1403,9 +1403,19 @@ try_again:
|
|||
/* Loop all Major Functions */
|
||||
for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
|
||||
{
|
||||
/* Set each function that was set to NULL to internal routine */
|
||||
/*
|
||||
* Make sure the driver didn't set any dispatch entry point to NULL!
|
||||
* Doing so is illegal; drivers shouldn't touch entry points they
|
||||
* do not implement.
|
||||
*/
|
||||
ASSERT(DriverObject->MajorFunction[i] != NULL);
|
||||
|
||||
/* Check if it did so anyway */
|
||||
if (!DriverObject->MajorFunction[i])
|
||||
{
|
||||
/* Fix it up */
|
||||
DriverObject->MajorFunction[i] = IopInvalidDeviceRequest;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the Status */
|
||||
|
|
|
@ -29,6 +29,9 @@ IoAllocateMdl(IN PVOID VirtualAddress,
|
|||
ULONG Flags = 0;
|
||||
ULONG Size;
|
||||
|
||||
/* Make sure we got a valid length */
|
||||
ASSERT(Length != 0);
|
||||
|
||||
/* Fail if allocation is over 2GB */
|
||||
if (Length & 0x80000000) return NULL;
|
||||
|
||||
|
|
|
@ -1134,6 +1134,9 @@ IofCallDriver(IN PDEVICE_OBJECT DeviceObject,
|
|||
PDRIVER_OBJECT DriverObject;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
|
||||
/* Make sure this is a valid IRP */
|
||||
ASSERT(Irp->Type == IO_TYPE_IRP);
|
||||
|
||||
/* Get the Driver Object */
|
||||
DriverObject = DeviceObject->DriverObject;
|
||||
|
||||
|
|
|
@ -173,8 +173,13 @@ MiAllocateContiguousMemory(IN SIZE_T NumberOfBytes,
|
|||
{
|
||||
PVOID BaseAddress;
|
||||
PFN_NUMBER SizeInPages;
|
||||
MI_PFN_CACHE_ATTRIBUTE CacheAttribute;
|
||||
MI_PFN_CACHE_ATTRIBUTE CacheAttribute;
|
||||
|
||||
//
|
||||
// Verify count and cache type
|
||||
//
|
||||
ASSERT(NumberOfBytes != 0);
|
||||
ASSERT(CacheType <= MmWriteCombined);
|
||||
|
||||
//
|
||||
// Compute size requested
|
||||
|
@ -352,7 +357,12 @@ MmAllocateContiguousMemorySpecifyCache(IN SIZE_T NumberOfBytes,
|
|||
IN MEMORY_CACHING_TYPE CacheType OPTIONAL)
|
||||
{
|
||||
PFN_NUMBER LowestPfn, HighestPfn, BoundaryPfn;
|
||||
ASSERT (NumberOfBytes != 0);
|
||||
|
||||
//
|
||||
// Verify count and cache type
|
||||
//
|
||||
ASSERT(NumberOfBytes != 0);
|
||||
ASSERT(CacheType <= MmWriteCombined);
|
||||
|
||||
//
|
||||
// Convert the lowest address into a PFN
|
||||
|
@ -396,7 +406,12 @@ MmAllocateContiguousMemory(IN ULONG NumberOfBytes,
|
|||
IN PHYSICAL_ADDRESS HighestAcceptableAddress)
|
||||
{
|
||||
PFN_NUMBER HighestPfn;
|
||||
|
||||
|
||||
//
|
||||
// Verify byte count
|
||||
//
|
||||
ASSERT(NumberOfBytes != 0);
|
||||
|
||||
//
|
||||
// Convert and normalize the highest address into a PFN
|
||||
//
|
||||
|
|
|
@ -57,7 +57,22 @@ MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress,
|
|||
PMMPFN Pfn1 = NULL;
|
||||
MI_PFN_CACHE_ATTRIBUTE CacheAttribute;
|
||||
BOOLEAN IsIoMapping;
|
||||
|
||||
|
||||
//
|
||||
// Must be called with a non-zero count
|
||||
//
|
||||
ASSERT(NumberOfBytes != 0);
|
||||
|
||||
//
|
||||
// Make sure the upper bits are 0 if this system
|
||||
// can't describe more than 4 GB of physical memory.
|
||||
// FIXME: This doesn't respect PAE, but we currently don't
|
||||
// define a PAE build flag since there is no such build.
|
||||
//
|
||||
#if !defined(_M_AMD64)
|
||||
ASSERT(PhysicalAddress.HighPart == 0);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Normalize and validate the caching attributes
|
||||
//
|
||||
|
|
|
@ -507,8 +507,13 @@ MmUnmapLockedPages(IN PVOID BaseAddress,
|
|||
// Get the PTE
|
||||
//
|
||||
PointerPte = MiAddressToPte(BaseAddress);
|
||||
|
||||
//
|
||||
// This should be a resident system PTE
|
||||
//
|
||||
ASSERT(PointerPte >= MmSystemPtesStart[SystemPteSpace]);
|
||||
ASSERT(PointerPte <= MmSystemPtesEnd[SystemPteSpace]);
|
||||
ASSERT(PointerPte->u.Hard.Valid == 1);
|
||||
|
||||
//
|
||||
// Check if the caller wants us to free advanced pages
|
||||
|
@ -715,7 +720,7 @@ MmProbeAndLockPages(IN PMDL Mdl,
|
|||
//
|
||||
// Sanity check
|
||||
//
|
||||
ASSERT(MdlPages = (PPFN_NUMBER)(Mdl + 1));
|
||||
ASSERT(MdlPages == (PPFN_NUMBER)(Mdl + 1));
|
||||
|
||||
//
|
||||
// Check what kind of operation this is
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue