From f165c00432b54d79f891646ca507bba79f55c7ed Mon Sep 17 00:00:00 2001 From: Royce Mitchell III Date: Tue, 5 Apr 2005 05:12:16 +0000 Subject: [PATCH 1/1] add some asserts svn path=/trunk/; revision=14498 --- reactos/ntoskrnl/io/mdl.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/reactos/ntoskrnl/io/mdl.c b/reactos/ntoskrnl/io/mdl.c index da6a4dbc7e0..b4b423f3560 100644 --- a/reactos/ntoskrnl/io/mdl.c +++ b/reactos/ntoskrnl/io/mdl.c @@ -4,7 +4,7 @@ * PROJECT: ReactOS kernel * FILE: ntoskrnl/io/mdl.c * PURPOSE: Io manager mdl functions - * + * * PROGRAMMERS: David Welch (welch@mcmail.com) */ @@ -32,7 +32,7 @@ IoAllocateMdl(PVOID VirtualAddress, PIRP Irp) { PMDL Mdl; - + if (ChargeQuota) { // Mdl = ExAllocatePoolWithQuota(NonPagedPool, @@ -48,27 +48,27 @@ IoAllocateMdl(PVOID VirtualAddress, TAG_MDL); } MmInitializeMdl(Mdl, (char*)VirtualAddress, Length); - + if (Irp) { if (SecondaryBuffer) { ASSERT(Irp->MdlAddress); - + /* FIXME: add to end of list maybe?? */ Mdl->Next = Irp->MdlAddress->Next; Irp->MdlAddress->Next = Mdl; } else { - /* + /* * What if there's allready an mdl at Irp->MdlAddress? * Is that bad and should we do something about it? */ Irp->MdlAddress = Mdl; } } - + return(Mdl); } @@ -122,13 +122,16 @@ IoBuildPartialMdl(PMDL SourceMdl, */ VOID STDCALL IoFreeMdl(PMDL Mdl) -{ - /* +{ + /* * This unmaps partial mdl's from kernel space but also asserts that non-partial * mdl's isn't still mapped into kernel space. */ + ASSERT(Mdl); + ASSERT_IRQL(DISPATCH_LEVEL); + MmPrepareMdlForReuse(Mdl); - + ExFreePool(Mdl); } -- 2.17.1