summaryrefslogtreecommitdiff
path: root/kernel/memory
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-05-02 12:38:02 -0400
committerFreya Murphy <freya@freyacat.org>2025-05-02 12:38:02 -0400
commited44d51f7dcaee989d6f36bab8042f438692e7ce (patch)
treecc8b72b9d059081afe25aa4da6354ae7ecfb3222 /kernel/memory
parentbroken? (diff)
downloadcomus-ed44d51f7dcaee989d6f36bab8042f438692e7ce.tar.gz
comus-ed44d51f7dcaee989d6f36bab8042f438692e7ce.tar.bz2
comus-ed44d51f7dcaee989d6f36bab8042f438692e7ce.zip
off by one
Diffstat (limited to 'kernel/memory')
-rw-r--r--kernel/memory/physalloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/memory/physalloc.c b/kernel/memory/physalloc.c
index 4255339..47522b8 100644
--- a/kernel/memory/physalloc.c
+++ b/kernel/memory/physalloc.c
@@ -27,7 +27,7 @@ static const char *segment_type_str[] = {
static int n_pages(const struct memory_segment *m)
{
- return m->len / PAGE_SIZE;
+ return (m->len + PAGE_SIZE - 1) / PAGE_SIZE;
}
static void *page_at(int i)