[igt-dev] [PATCH i-g-t] tests/intel/xe_copy_basic: Fix validating the mem set values.

sai.gowtham.ch at intel.com sai.gowtham.ch at intel.com
Wed Oct 25 02:20:50 UTC 2023


From: Sai Gowtham Ch <sai.gowtham.ch at intel.com>

Avoid crash by memory un mapping the dst.ptr after validating the set
values.

Signed-off-by: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
---
 tests/intel/xe_copy_basic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/intel/xe_copy_basic.c b/tests/intel/xe_copy_basic.c
index 059c54488..fe78ac50f 100644
--- a/tests/intel/xe_copy_basic.c
+++ b/tests/intel/xe_copy_basic.c
@@ -113,13 +113,14 @@ mem_set(int fd, uint32_t dst_handle, const intel_ctx_t *ctx, uint32_t size,
 	result = (uint8_t *)mem.dst.ptr;
 
 	intel_allocator_bind(ahnd, 0, 0);
-	munmap(mem.dst.ptr, size);
 	gem_close(fd, bb);
 	put_ahnd(ahnd);
 
 	igt_assert(result[0] == fill_data);
 	igt_assert(result[width - 1] == fill_data);
 	igt_assert(result[width] != fill_data);
+
+	munmap(mem.dst.ptr, size);
 }
 
 static void copy_test(int fd, uint32_t size, enum blt_cmd_type cmd, uint32_t region)
-- 
2.39.1



More information about the igt-dev mailing list