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

Kumar, Janga Rahul janga.rahul.kumar at intel.com
Wed Oct 25 05:56:18 UTC 2023


LGTM,
Reviewed-by: Janga Rahul Kumar<janga.rahul.kumar at intel.com>

> -----Original Message-----
> From: igt-dev <igt-dev-bounces at lists.freedesktop.org> On Behalf Of
> sai.gowtham.ch at intel.com
> Sent: Wednesday, October 25, 2023 7:51 AM
> To: igt-dev at lists.freedesktop.org; Ch, Sai Gowtham
> <sai.gowtham.ch at intel.com>
> Subject: [igt-dev] [PATCH i-g-t] tests/intel/xe_copy_basic: Fix validating the
> mem set values.
> 
> 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