From 0a22320a3c286d20f2561aae9cccf94692a2e35b Mon Sep 17 00:00:00 2001 From: Hannes Weisbach Date: Wed, 20 Sep 2017 10:34:49 +0900 Subject: [PATCH] Don't allocate memory for 0-page-sized requests Previously the allocator would return all availble memory for a request of 0 pages. This is rather counter-intuitive and left no memory for subsequent allocations. --- kernel/mem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/mem.c b/kernel/mem.c index 78671ba2..23a28b21 100644 --- a/kernel/mem.c +++ b/kernel/mem.c @@ -553,6 +553,9 @@ static void *mckernel_allocate_aligned_pages_node(int npages, int p2align, #endif int numa_id; + if(npages <= 0) + return NULL; + /* Not yet initialized or idle process */ if (!cpu_local_var_initialized || !cpu_local_var(current) ||