sandbox: memblock: abort on unsatisfiable alloc request

This commit is contained in:
2023-01-29 11:15:43 +00:00
parent a7ebdeba73
commit 885ed7d765

View File

@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdbool.h>
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include <socks/memblock.h>
@@ -225,7 +226,8 @@ static phys_addr_t do_alloc(size_t size)
}
if (allocated_base == ADDR_MAX) {
return 0;
fprintf(stderr, "memblock: cannot allocate %zu byte buffer!\n", size);
abort();
}
int status = memblock_add_range(&memblock.reserved, allocated_base, size, MEMBLOCK_ALLOC);