From 03c7b160e831fb977ce3c4003ae43853e48dbe2a Mon Sep 17 00:00:00 2001 From: "Chloe M." Date: Sun, 12 Jul 2026 06:23:18 +0000 Subject: [PATCH] ptos: mm: Add missing NULL checks Signed-off-by: Chloe M. --- service/ptos/mm/pm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); }