Boundary check in early_alloc_pages()
This commit is contained in:
@ -45,7 +45,11 @@ void *early_alloc_pages(int nr_pages)
|
|||||||
last_page = phys_to_virt(virt_to_phys(last_page));
|
last_page = phys_to_virt(virt_to_phys(last_page));
|
||||||
} else if (last_page == (void *)-1) {
|
} else if (last_page == (void *)-1) {
|
||||||
panic("Early allocator is already finalized. Do not use it.\n");
|
panic("Early allocator is already finalized. Do not use it.\n");
|
||||||
}
|
} else {
|
||||||
|
if(virt_to_phys(last_page) >= bootstrap_mem_end) {
|
||||||
|
panic("Early allocator: Out of memory\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
p = last_page;
|
p = last_page;
|
||||||
last_page += (nr_pages * PAGE_SIZE);
|
last_page += (nr_pages * PAGE_SIZE);
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,8 @@ enum ihk_mc_gma_type {
|
|||||||
IHK_MC_RESERVED_AREA_END,
|
IHK_MC_RESERVED_AREA_END,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern unsigned long bootstrap_mem_end;
|
||||||
|
|
||||||
enum ihk_mc_ma_type {
|
enum ihk_mc_ma_type {
|
||||||
IHK_MC_MA_AVAILABLE,
|
IHK_MC_MA_AVAILABLE,
|
||||||
IHK_MC_MA_RESERVED,
|
IHK_MC_MA_RESERVED,
|
||||||
|
|||||||
Reference in New Issue
Block a user