Message ID | 20210120111115.846341-1-chris@chris-wilson.co.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [i-g-t,1/2] i915/gem_create: Check wrap condition for -1 | expand |
On Wed, 20 Jan 2021 at 11:11, Chris Wilson <chris@chris-wilson.co.uk> wrote: > > 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>
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); } /*
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(-)