From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 03/48] drm/i915: Don't unconditionally try to deref aliasing ppgtt Date: Wed, 18 Dec 2013 14:50:38 +0100 Message-ID: <20131218135037.GG26371@phenom.ffwll.local> References: <20131206215521.GA6922@bwidawsk.net> <1386367941-7131-1-git-send-email-benjamin.widawsky@intel.com> <1386367941-7131-3-git-send-email-benjamin.widawsky@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 62358FCC5B for ; Wed, 18 Dec 2013 05:49:45 -0800 (PST) Received: by mail-ee0-f43.google.com with SMTP id c13so3540681eek.2 for ; Wed, 18 Dec 2013 05:49:44 -0800 (PST) Content-Disposition: inline In-Reply-To: <1386367941-7131-3-git-send-email-benjamin.widawsky@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: Ben Widawsky Cc: Intel GFX , Ben Widawsky List-Id: intel-gfx@lists.freedesktop.org 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 > Date: Wed Jul 31 16:59:56 2013 -0700 > > drm/i915: Make proper functions for VMs > > Signed-off-by: Ben Widawsky 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