diff --git a/service/ptos/mm/pm.c b/service/ptos/mm/pm.c index bcef43f..80eba98 100644 --- a/service/ptos/mm/pm.c +++ b/service/ptos/mm/pm.c @@ -139,6 +139,10 @@ PmPfdListPop(MM_PFD_LIST *List) } FirstPfd = List->First; + if (FirstPfd == NULL) { + return NULL; + } + List->First = FirstPfd->Next; return FirstPfd; } @@ -219,8 +223,11 @@ MmRequestFrame(VOID) UPTR PhysicalBase; Pfd = PmPfdListPop(&AvlList); - RtlMemSet(Pfd, 0, PAGESIZE); + if (Pfd == NULL) { + return PFN_ERROR; + } + RtlMemSet(Pfd, 0, PAGESIZE); PhysicalBase = VMA_TO_PMA(Pfd); return ADDRESS_TO_PFN(PhysicalBase); }