From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Check new context against kernel_context after reporting an error
Date: Wed, 5 Jul 2017 14:46:11 +0100 [thread overview]
Message-ID: <789e4155-f7de-ce4c-eae9-80205e64bc6c@linux.intel.com> (raw)
In-Reply-To: <20170705131820.20501-1-chris@chris-wilson.co.uk>
On 05/07/2017 14:18, Chris Wilson wrote:
> Avoid any pointer dereference in inspecting a potential PTR_ERR by
> checking for the error pointer before checking for an invalid context.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_gem_context.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 2eb5d8203999..98d2ce98f467 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -571,14 +571,13 @@ int i915_gem_context_open(struct drm_i915_private *i915,
> mutex_lock(&i915->drm.struct_mutex);
> ctx = i915_gem_create_context(i915, file_priv);
> mutex_unlock(&i915->drm.struct_mutex);
> -
> - GEM_BUG_ON(i915_gem_context_is_kernel(ctx));
> -
> if (IS_ERR(ctx)) {
> idr_destroy(&file_priv->context_idr);
> return PTR_ERR(ctx);
> }
>
> + GEM_BUG_ON(i915_gem_context_is_kernel(ctx));
> +
> return 0;
> }
>
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2017-07-05 13:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-05 13:18 [PATCH 1/2] drm/i915: Check new context against kernel_context after reporting an error Chris Wilson
2017-07-05 13:18 ` [PATCH 2/2] drm/i915: Move stale context reaping to common i915_gem_context_create Chris Wilson
2017-07-05 13:50 ` Tvrtko Ursulin
2017-07-05 14:08 ` Chris Wilson
2017-07-05 13:37 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Check new context against kernel_context after reporting an error Patchwork
2017-07-05 13:46 ` Tvrtko Ursulin [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=789e4155-f7de-ce4c-eae9-80205e64bc6c@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/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