Re: [patch] drm/i915: dereferencing an error pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 17, 2012 at 09:44:49AM +0300, Dan Carpenter wrote:
> We need to check that "ctx" is a valid pointer before dereferencing it.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

Queued for drm-intel-next, thanks for the patch.
-Daniel

> ---
> Applies to linux-next.
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
> index 9ae3f2c..a82c0ec 100644
> --- a/drivers/gpu/drm/i915/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/i915_gem_context.c
> @@ -496,11 +496,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,

-- 
Daniel Vetter
Mail: daniel@xxxxxxxx
Mobile: +41 (0)79 365 57 48
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux