Skip to content

Commit e9ad711

Browse files
committed
Panic with proper error message if memory map is full
1 parent bd378db commit e9ad711

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/bootinfo/memory_map.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ impl MemoryMap {
2222
}
2323

2424
pub fn add_region(&mut self, region: MemoryRegion) {
25+
assert!(self.next_entry_index() < MAX_MEMORY_MAP_SIZE,
26+
"too many memory regions in memory map");
2527
self.entries[self.next_entry_index()] = region;
2628
self.next_entry_index += 1;
2729
self.sort();

0 commit comments

Comments
 (0)