[Intel-gfx] [PATCH 03/48] drm/i915: Don't unconditionally try to deref aliasing ppgtt
Daniel Vetter
daniel at ffwll.ch
Wed Dec 18 14:50:38 CET 2013
On Fri, Dec 06, 2013 at 02:10:48PM -0800, Ben Widawsky wrote:
> Since the beginning, the functions which try to properly reference the
> aliasing PPGTT have deferences a potentially null aliasing_ppgtt member.
> Since the accessors are meant to be global, this will not do.
>
> Introduced originally in:
> commit a70a3148b0c61cb7c588ea650db785b261b378a3
> Author: Ben Widawsky <ben at bwidawsk.net>
> Date: Wed Jul 31 16:59:56 2013 -0700
>
> drm/i915: Make proper functions for VMs
>
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
Has this really blown up? Last time I've checked pointer arithmetics like
this was perfectly legal ... Applied anyway since I want to kill these two
functions later on.
-Daniel
> ---
> drivers/gpu/drm/i915/i915_gem.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 8b18c2a..5278b67 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4974,7 +4974,8 @@ unsigned long i915_gem_obj_offset(struct drm_i915_gem_object *o,
> struct drm_i915_private *dev_priv = o->base.dev->dev_private;
> struct i915_vma *vma;
>
> - if (vm == &dev_priv->mm.aliasing_ppgtt->base)
> + if (!dev_priv->mm.aliasing_ppgtt ||
> + vm == &dev_priv->mm.aliasing_ppgtt->base)
> vm = &dev_priv->gtt.base;
>
> BUG_ON(list_empty(&o->vma_list));
> @@ -5015,7 +5016,8 @@ unsigned long i915_gem_obj_size(struct drm_i915_gem_object *o,
> struct drm_i915_private *dev_priv = o->base.dev->dev_private;
> struct i915_vma *vma;
>
> - if (vm == &dev_priv->mm.aliasing_ppgtt->base)
> + if (!dev_priv->mm.aliasing_ppgtt ||
> + vm == &dev_priv->mm.aliasing_ppgtt->base)
> vm = &dev_priv->gtt.base;
>
> BUG_ON(list_empty(&o->vma_list));
> --
> 1.8.4.2
>
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the Intel-gfx
mailing list