Bitmap size in buddy_alloc.cpp

Christian Ehrhardt Christian_Ehrhardt at genua.de
Tue May 3 13:26:19 CEST 2011


Access to the _free_map bitmap in the buddy allocator is possible
beyond Max_mem when checking the free bit of the buddy. Thus bit
bitmap size should be aligned to Max_size not Min_size.

    regards   Christian

diff --git a/src/kernel/fiasco/src/kern/buddy_alloc.cpp b/src/kernel/fiasco/src/kern/buddy_alloc.cpp
index 96f2821..51e1239 100644
--- a/src/kernel/fiasco/src/kern/buddy_alloc.cpp
+++ b/src/kernel/fiasco/src/kern/buddy_alloc.cpp
@@ -55,7 +55,7 @@ public:
 
 private:
   Head *_free[Num_sizes];
-  Bitmap<(Max_mem+Min_size-1)/Min_size> _free_map;
+  Bitmap<(Max_mem+Max_size-1)/Min_size> _free_map;
 };
 
 




More information about the l4-hackers mailing list