diff mbox series

[2/3] drm/i915/gem: sanity check object size in gem_create

Message ID 20210114182402.840247-2-matthew.auld@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/i915/gem: split gem_create into own file | expand

Commit Message

Matthew Auld Jan. 14, 2021, 6:24 p.m. UTC
Depending on the regions min_page_size we might need to adjust the
object size, ensure this matches our expectations.

Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_create.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Chris Wilson Jan. 14, 2021, 8:57 p.m. UTC | #1
Quoting Matthew Auld (2021-01-14 18:24:01)
> Depending on the regions min_page_size we might need to adjust the
> object size, ensure this matches our expectations.
> 
> Suggested-by: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_create.c b/drivers/gpu/drm/i915/gem/i915_gem_create.c
index ce923ed49eee..45d60e3d98e3 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_create.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_create.c
@@ -32,6 +32,8 @@  i915_gem_create(struct drm_file *file,
 	if (IS_ERR(obj))
 		return PTR_ERR(obj);
 
+	GEM_BUG_ON(size != obj->base.size);
+
 	ret = drm_gem_handle_create(file, &obj->base, &handle);
 	/* drop reference from allocate - handle holds it now */
 	i915_gem_object_put(obj);