On Thu, May 18, 2017 at 03:59:39PM +0200, Michał Winiarski wrote: > Passing NULL ctx to request_alloc would lead to null-ptr-deref. > Let's replace the comment with GEM_BUG_ON. > > Signed-off-by: Michał Winiarski <michal.winiarski@xxxxxxxxx> > --- > drivers/gpu/drm/i915/i915_gem_request.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c > index 1ccf252..1352d3c 100644 > --- a/drivers/gpu/drm/i915/i915_gem_request.c > +++ b/drivers/gpu/drm/i915/i915_gem_request.c > @@ -538,9 +538,6 @@ submit_notify(struct i915_sw_fence *fence, enum i915_sw_fence_notify state) > * > * @engine: engine that we wish to issue the request on. > * @ctx: context that the request will be associated with. > - * This can be NULL if the request is not directly related to > - * any specific user context, in which case this function will > - * choose an appropriate context to use. > * > * Returns a pointer to the allocated request if successful, > * or an error code if not. > @@ -554,6 +551,7 @@ i915_gem_request_alloc(struct intel_engine_cs *engine, > struct intel_ring *ring; > int ret; > > + GEM_BUG_ON(!ctx); We try not to use BUG_ON for NULL pointer protection, as the NULL pointer GPF is often enough to pinpoint the error. NULL function pointers tend to be the exception. > lockdep_assert_held(&dev_priv->drm.struct_mutex); > > /* ABI: Before userspace accesses the GPU (e.g. execbuffer), report > -- > 2.9.4 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx