intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Matthew Auld <matthew.auld@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: check vma for error in ggtt_unpin_view
Date: Thu, 24 Mar 2016 16:32:57 +0200	[thread overview]
Message-ID: <1458829977.7860.17.camel@linux.intel.com> (raw)
In-Reply-To: <1458747584-29772-1-git-send-email-matthew.auld@intel.com>

On ke, 2016-03-23 at 15:39 +0000, Matthew Auld wrote:
> When unpinning a ggtt_view check vma for error, otherwise we may end up
> accessing an invalid pointer.
> 
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index 8588c83..a8f3378 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -4319,7 +4319,7 @@ i915_gem_object_ggtt_unpin_view(struct drm_i915_gem_object *obj,
>  {
>  	struct i915_vma *vma = i915_gem_obj_to_ggtt_view(obj, view);
>  
> -	BUG_ON(!vma);
> +	BUG_ON(IS_ERR_OR_NULL(vma));

Nicely spotted.

I discussed this with Tvrtko (CC'd him). I think we could
change i915_gem_obj_to_ggtt_view to BUG_ON(!view) instead of adding the
error handling in all places, as it is after all a programmer error to
provide NULL view.

Regards, Joonas

>  	WARN_ON(vma->pin_count == 0);
>  	WARN_ON(!i915_gem_obj_ggtt_bound_view(obj, view));
>  
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2016-03-24 14:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-23 15:39 [PATCH] drm/i915: check vma for error in ggtt_unpin_view Matthew Auld
2016-03-23 17:32 ` ✗ Fi.CI.BAT: failure for " Patchwork
2016-03-24 14:32 ` Joonas Lahtinen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1458829977.7860.17.camel@linux.intel.com \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).