[PATCH i-g-t 10/12] lib/intel_allocator_simple: Check boundaries of reserved blocks

Andrzej Turko andrzej.turko at linux.intel.com
Thu Jul 22 11:38:23 UTC 2021


Make sure that reserved blocks fit in the
address space managed by the simple allocator.

Signed-off-by: Andrzej Turko <andrzej.turko at linux.intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
 lib/intel_allocator_simple.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/intel_allocator_simple.c b/lib/intel_allocator_simple.c
index 0e6763964..8d5105f11 100644
--- a/lib/intel_allocator_simple.c
+++ b/lib/intel_allocator_simple.c
@@ -523,6 +523,8 @@ static bool intel_allocator_simple_reserve(struct intel_allocator *ial,
 	end = DECANONICAL(end);
 	igt_assert(end > start || end == 0);
 	size = get_size(start, end);
+	igt_assert(start + size <= ials->end);
+	igt_assert(start >= ials->start);
 
 	if (simple_vma_heap_alloc_addr(ials, start, size)) {
 		rec = malloc(sizeof(*rec));
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list