From a08a7dd1a48aa192d70bcabe221d627f41a9081f Mon Sep 17 00:00:00 2001 From: Michael Shaw Date: Fri, 14 Apr 2023 12:56:11 -0400 Subject: [PATCH] mem: set buddy_alloc_helper minimum size to 0x1000 bytes --- mem/buddy.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mem/buddy.c b/mem/buddy.c index 40ea477..7aa2aed 100644 --- a/mem/buddy.c +++ b/mem/buddy.c @@ -102,6 +102,11 @@ static paddr_t buddy_alloc_helper(struct buddy_region_header *head, size_t size) printf(LOG_WARN "buddy_alloc: size not a power of 2\n"); } + if (size < 0x1000) { + printf(LOG_WARN "buddy_alloc: size too small\n"); + return 0; + } + struct buddy_free_list *flist = head->flist; while (flist != NULL) {