From: Ville Syrjälä Date: Tue, 9 Apr 2013 17:09:13 +0000 (+0300) Subject: drm/i915: Reject fence stride=0 on gen4+ X-Git-Tag: v3.10-rc2~14^2~19^2~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe48d8de34eeaefb2c71dab68ea7c236f06e5877;p=profile%2Fcommon%2Fkernel-common.git drm/i915: Reject fence stride=0 on gen4+ Our checks for an invalid fence stride forgot to guard against zero stride on gen4+. Fix it. v2: Avoid duplicated code (danvet) Signed-off-by: Ville Syrjälä Signed-off-by: Daniel Vetter --- diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index c807eb9..b56185f 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c @@ -235,6 +235,9 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) } } + if (stride < tile_width) + return false; + /* 965+ just needs multiples of tile width */ if (INTEL_INFO(dev)->gen >= 4) { if (stride & (tile_width - 1)) @@ -243,9 +246,6 @@ i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode) } /* Pre-965 needs power of two tile widths */ - if (stride < tile_width) - return false; - if (stride & (stride - 1)) return false;