From 3e5eeacf095f36387d6ad541aaea155d185d1f0a Mon Sep 17 00:00:00 2001 From: Ali Mashtizadeh Date: Sun, 3 Sep 2023 14:56:44 -0400 Subject: [PATCH] Add extra ASSERTs to PAlloc_AllocPage --- sys/kern/palloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/kern/palloc.c b/sys/kern/palloc.c index 9d7f56a..e958f6c 100644 --- a/sys/kern/palloc.c +++ b/sys/kern/palloc.c @@ -171,13 +171,16 @@ PAlloc_AllocPage() Spinlock_Lock(&pallocLock); pg = LIST_FIRST(&freeList); + ASSERT(pg != NULL); LIST_REMOVE(pg, entries); + ASSERT(pg->magic == FREEPAGE_MAGIC_FREE); + info = PAllocGetInfo(pg); + ASSERT(info != NULL); ASSERT(info->refCount == 0); info->refCount++; - ASSERT(pg->magic == FREEPAGE_MAGIC_FREE); pg->magic = FREEPAGE_MAGIC_INUSE; freePages--;