Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/2] i915/gem_mmap_offset: Check mapping availability
Date: Wed, 11 Jan 2023 11:26:32 +0100	[thread overview]
Message-ID: <20230111102633.27518-2-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20230111102633.27518-1-zbigniew.kempczynski@intel.com>

When we pass invalid handles to GEM_MMAP_OFFSET ioctl we should check
return error code only for supported mapping types. Use real handle
to verify kernel supports such mapping type.

Signed-off-by: Chris Wilson <chris.p.wilson@linux.intel.com>
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
 tests/i915/gem_mmap_offset.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_mmap_offset.c b/tests/i915/gem_mmap_offset.c
index b27920de2e..b38b7edae3 100644
--- a/tests/i915/gem_mmap_offset.c
+++ b/tests/i915/gem_mmap_offset.c
@@ -190,12 +190,17 @@ static void bad_object(int i915)
 	for (; i >= 0; i--) {
 		for_each_mmap_offset_type(i915, t) {
 			struct drm_i915_gem_mmap_offset arg = {
-				.handle = handles[i],
+				.handle = real_handle,
 				.flags = t->type,
 			};
 
+			if (mmap_offset_ioctl(i915, &arg))
+				continue;
+
 			igt_debug("Trying MMAP IOCTL[%s] with handle %x\n",
 				  t->name, handles[i]);
+
+			arg.handle = handles[i];
 			igt_assert_eq(mmap_offset_ioctl(i915, &arg),
 				      -ENOENT);
 		}
-- 
2.34.1

  reply	other threads:[~2023-01-11 10:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11 10:26 [igt-dev] [PATCH i-g-t 0/2] Fix two issues in gem_mmap_offset test Zbigniew Kempczyński
2023-01-11 10:26 ` Zbigniew Kempczyński [this message]
2023-01-11 16:46   ` [igt-dev] [PATCH i-g-t 1/2] i915/gem_mmap_offset: Check mapping availability Kamil Konieczny
2023-01-11 10:26 ` [igt-dev] [PATCH i-g-t 2/2] i915/gem_mmap_offset: Avoid FPE in calculating npages to clear Zbigniew Kempczyński
2023-01-11 17:09   ` Kamil Konieczny
2023-01-11 12:36 ` [igt-dev] ✓ Fi.CI.BAT: success for Fix two issues in gem_mmap_offset test Patchwork
2023-01-11 18:14 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20230111102633.27518-2-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@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