diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2021-01-20 11:03:19 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2021-01-20 12:50:56 +0000 |
commit | 92dd61d0ecf0b05c3d805227da1fabbfdb850cf5 (patch) | |
tree | 1abaeeef323fd8cc1eec5d6fe1adff4425af4460 | |
parent | ace82fcd5f3623f8dde7c220a825873dc53dfae4 (diff) |
i915/gem_create: Check wrap condition for -1
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>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
-rw-r--r-- | tests/i915/gem_create.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c index bf653184..c0ad56a3 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); } /* |