On Thu, Oct 08, 2015 at 07:31:37PM +0100, Tomas Elf wrote:
> Sometimes the iterated vma objects are NULL apparently. Be aware of this while
> iterating and do early exit instead of causing a NULL pointer exception.
> 
> Signed-off-by: Tomas Elf <tomas....@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 52642af..8210ae7 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -5122,9 +5122,13 @@ unsigned long i915_gem_obj_size(struct 
> drm_i915_gem_object *o,
>  bool i915_gem_obj_is_pinned(struct drm_i915_gem_object *obj)
>  {
>       struct i915_vma *vma;
> -     list_for_each_entry(vma, &obj->vma_list, vma_link)
> +     list_for_each_entry(vma, &obj->vma_list, vma_link) {
> +             if (!vma)
> +                     continue;

Again no need to check for that if we rcu-protect this list and vmas.
-Daniel

> +
>               if (vma->pin_count > 0)
>                       return true;
> +     }
>  
>       return false;
>  }
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to