aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem_gtt.h
diff options
context:
space:
mode:
authorMichel Thierry <michel.thierry@intel.com>2015-03-24 15:46:19 +0000
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-03-27 09:24:55 +0100
commitfdc454c1484a20e1345cf4e4d7a9feaee814147f (patch)
tree6e8d9fc78b3ddb91be84cb84b38bfea7fb347a1e /drivers/gpu/drm/i915/i915_gem_gtt.h
parentdrm/i915: fix definition of the DRM_IOCTL_I915_GET_SPRITE_COLORKEY ioctl (diff)
downloadlinux-dev-fdc454c1484a20e1345cf4e4d7a9feaee814147f.tar.xz
linux-dev-fdc454c1484a20e1345cf4e4d7a9feaee814147f.zip
drm/i915: Prevent out of range pt in gen6_for_each_pde
Found by static analysis tool, this was harmless as the pt was not used out of scope though. Introduced by commit 678d96fbb3b5995a2fdff2bca5e1ab4a40b7e968 ("drm/i915: Track GEN6 page table usage"). Cc: Mika Kuoppala <mika.kuoppala@intel.com> Signed-off-by: Michel Thierry <michel.thierry@intel.com> Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_gtt.h')
-rw-r--r--drivers/gpu/drm/i915/i915_gem_gtt.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 0dad42634fd5..3d873467377e 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -339,9 +339,9 @@ struct i915_hw_ppgtt {
* XXX: temp is not actually needed, but it saves doing the ALIGN operation.
*/
#define gen6_for_each_pde(pt, pd, start, length, temp, iter) \
- for (iter = gen6_pde_index(start), pt = (pd)->page_table[iter]; \
- length > 0 && iter < I915_PDES; \
- pt = (pd)->page_table[++iter], \
+ for (iter = gen6_pde_index(start); \
+ pt = (pd)->page_table[iter], length > 0 && iter < I915_PDES; \
+ iter++, \
temp = ALIGN(start+1, 1 << GEN6_PDE_SHIFT) - start, \
temp = min_t(unsigned, temp, length), \
start += temp, length -= temp)