Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sai.gowtham.ch@intel.com
To: igt-dev@lists.freedesktop.org, sai.gowtham.ch@intel.com
Subject: [igt-dev] [PATCH i-g-t] tests/intel/xe_copy_basic: Fix validating the mem set values.
Date: Wed, 25 Oct 2023 07:50:50 +0530	[thread overview]
Message-ID: <20231025022050.14282-1-sai.gowtham.ch@intel.com> (raw)

From: Sai Gowtham Ch <sai.gowtham.ch@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@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

             reply	other threads:[~2023-10-25  2:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25  2:20 sai.gowtham.ch [this message]
2023-10-25  4:08 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/intel/xe_copy_basic: Fix validating the mem set values Patchwork
2023-10-25  5:56 ` [igt-dev] [PATCH i-g-t] " Kumar, Janga Rahul
2023-10-25 19:29 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231025022050.14282-1-sai.gowtham.ch@intel.com \
    --to=sai.gowtham.ch@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox