drm/i915: Assert internal objects are page aligned
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 16 Jan 2017 14:52:42 +0000 (14:52 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 17 Jan 2017 09:09:56 +0000 (09:09 +0000)
Internal objects must be passed a page-aligned size. Check it.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170116145242.13875-1-chris@chris-wilson.co.uk
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/i915_gem_internal.c

index 9b39472396effae5a2bd8c3ff878fb0712847aca..17ce53d0d092fbeb60a8a52d7839887613490de2 100644 (file)
@@ -156,6 +156,7 @@ i915_gem_object_create_internal(struct drm_i915_private *i915,
        struct drm_i915_gem_object *obj;
 
        GEM_BUG_ON(!size);
+       GEM_BUG_ON(!IS_ALIGNED(size, PAGE_SIZE));
 
        if (overflows_type(size, obj->base.size))
                return ERR_PTR(-E2BIG);