All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH i-g-t 1/2] i915/gem_create: Check wrap condition for -1
@ 2021-01-20 11:11 Chris Wilson
  2021-01-20 11:11 ` [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_create: Exercise an impossible allocation Chris Wilson
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Chris Wilson @ 2021-01-20 11:11 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev, matthew.auld, Chris Wilson

Check that we correctly reject an object size that will intentionally
wrap upon aligning to a page.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_create.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
index bf6531844..432ccdefa 100644
--- a/tests/i915/gem_create.c
+++ b/tests/i915/gem_create.c
@@ -79,11 +79,15 @@ static int create_ioctl(int fd, struct drm_i915_gem_create *create)
 
 static void invalid_size_test(int fd)
 {
-	struct drm_i915_gem_create create = {
-		.size = 0,
-	};
+	struct drm_i915_gem_create create = { };
 
+	create.size = 0; /* zero-sized objects are not allowed */
 	igt_assert_eq(create_ioctl(fd, &create), -EINVAL);
+
+	create.size = -1ull; /* will wrap to 0 on aligning to page */
+	igt_assert_eq(create_ioctl(fd, &create), -EINVAL);
+
+	igt_assert_eq(create.handle, 0);
 }
 
 /*
-- 
2.30.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-01-20 14:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 11:11 [Intel-gfx] [PATCH i-g-t 1/2] i915/gem_create: Check wrap condition for -1 Chris Wilson
2021-01-20 11:11 ` [Intel-gfx] [PATCH i-g-t 2/2] i915/gem_create: Exercise an impossible allocation Chris Wilson
2021-01-20 11:58   ` Matthew Auld
2021-01-20 11:58     ` [igt-dev] " Matthew Auld
2021-01-20 11:56 ` [Intel-gfx] [PATCH i-g-t 1/2] i915/gem_create: Check wrap condition for -1 Matthew Auld
2021-01-20 11:56   ` [igt-dev] " Matthew Auld
2021-01-20 13:00 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] " Patchwork
2021-01-20 14:33 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.