Bitmap size in buddy_alloc.cpp

Alexander Warg alexander.warg at os.inf.tu-dresden.de
Wed May 4 20:51:23 CEST 2011


On Tue, 2011-05-03 at 13:26 +0200, Christian Ehrhardt wrote:
> 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;
>  };

Tanks,
however, the fix is somehow different, we only need a single extra bit
in the case when Max_mem is not a multiple of Max_size (not the case in
Fiasco, 64MB and 128kB).

Anyway, good point in general.

-- 
Alex





More information about the l4-hackers mailing list