From ecf46ebc826cc31779be192a2ec4d6bbaefaf2b0 Mon Sep 17 00:00:00 2001 From: Alex Ionescu Date: Thu, 4 Oct 2012 06:19:42 +0000 Subject: [PATCH] [NTOSKRNL]: CORE-6698 #resolve #time 5m #comment Add correct error handling during session space view mapping. svn path=/trunk/; revision=57475 --- reactos/ntoskrnl/mm/ARM3/section.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/section.c b/reactos/ntoskrnl/mm/ARM3/section.c index 5fb9b050f90..befa6bae1df 100644 --- a/reactos/ntoskrnl/mm/ARM3/section.c +++ b/reactos/ntoskrnl/mm/ARM3/section.c @@ -1021,8 +1021,10 @@ MiMapViewInSystemSpace(IN PVOID Section, /* Check if the caller wanted a larger section than the view */ if (*ViewSize > SectionSize) { - /* We should probably fail. FIXME TODO */ - ASSERT(FALSE); + /* Fail */ + DPRINT1("View is too large\n"); + MiDereferenceControlArea(ControlArea); + return STATUS_INVALID_VIEW_SIZE; } /* Get the number of 64K buckets required for this mapping */ @@ -1032,14 +1034,22 @@ MiMapViewInSystemSpace(IN PVOID Section, /* Check if the view is more than 4GB large */ if (Buckets >= MI_SYSTEM_VIEW_BUCKET_SIZE) { - /* We should probably fail */ - ASSERT(FALSE); + /* Fail */ + DPRINT1("View is too large\n"); + MiDereferenceControlArea(ControlArea); + return STATUS_INVALID_VIEW_SIZE; } /* Insert this view into system space and get a base address for it */ Base = MiInsertInSystemSpace(Session, Buckets, ControlArea); - ASSERT(Base); - + if (!Base) + { + /* Fail */ + DPRINT1("Out of system space\n"); + MiDereferenceControlArea(ControlArea); + return STATUS_NO_MEMORY; + } + /* What's the underlying session? */ if (Session == &MmSession) {