Commit 051c89cf authored by Chris Wilson's avatar Chris Wilson Committed by Jani Nikula

drm/i915/gem: Detect overflow in calculating dumb buffer size

To multiply 2 u32 numbers to generate a u64 in C requires a bit of
forewarning for the compiler.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Ramalingam C <ramalingam.c@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200123125934.1401755-1-chris@chris-wilson.co.uk
(cherry picked from commit 0f8f8a64)
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent 1a9629d1
...@@ -265,7 +265,10 @@ i915_gem_dumb_create(struct drm_file *file, ...@@ -265,7 +265,10 @@ i915_gem_dumb_create(struct drm_file *file,
DRM_FORMAT_MOD_LINEAR)) DRM_FORMAT_MOD_LINEAR))
args->pitch = ALIGN(args->pitch, 4096); args->pitch = ALIGN(args->pitch, 4096);
args->size = args->pitch * args->height; if (args->pitch < args->width)
return -EINVAL;
args->size = mul_u32_u32(args->pitch, args->height);
mem_type = INTEL_MEMORY_SYSTEM; mem_type = INTEL_MEMORY_SYSTEM;
if (HAS_LMEM(to_i915(dev))) if (HAS_LMEM(to_i915(dev)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment