Skip to content

Commit

Permalink
drm/i915: dereferencing an error pointer
Browse files Browse the repository at this point in the history
We need to check that "ctx" is a valid pointer before dereferencing it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Dan Carpenter authored and Daniel Vetter committed Jul 25, 2012
1 parent b259b31 commit be63638
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/i915/i915_gem_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,11 +497,13 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,

ctx = create_hw_context(dev, file_priv);
mutex_unlock(&dev->struct_mutex);
if (IS_ERR(ctx))
return PTR_ERR(ctx);

args->ctx_id = ctx->id;
DRM_DEBUG_DRIVER("HW context %d created\n", args->ctx_id);

return PTR_RET(ctx);
return 0;
}

int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
Expand Down

0 comments on commit be63638

Please sign in to comment.