drm/i915: fix MAX_ORDER usage in i915_gem_object_get_pages_internal()
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Wed, 15 Mar 2023 11:31:27 +0000 (14:31 +0300)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 6 Apr 2023 02:42:45 +0000 (19:42 -0700)
MAX_ORDER is not inclusive: the maximum allocation order buddy allocator
can deliver is MAX_ORDER-1.

Fix MAX_ORDER usage in i915_gem_object_get_pages_internal().

Link: https://lkml.kernel.org/r/20230315113133.11326-5-kirill.shutemov@linux.intel.com
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/gpu/drm/i915/gem/i915_gem_internal.c

index 6bc26b4..eae9e9f 100644 (file)
@@ -36,7 +36,7 @@ static int i915_gem_object_get_pages_internal(struct drm_i915_gem_object *obj)
        struct sg_table *st;
        struct scatterlist *sg;
        unsigned int npages; /* restricted by sg_alloc_table */
-       int max_order = MAX_ORDER;
+       int max_order = MAX_ORDER - 1;
        unsigned int max_segment;
        gfp_t gfp;