[Intel-gfx] [bug report] drm/i915: Add an implementation for i915_gem_ww_ctx locking, v2.

Dan Carpenter dan.carpenter at oracle.com
Fri Sep 11 11:34:41 UTC 2020


Hello Maarten Lankhorst,

This is a semi-automatic email about new static checker warnings.

The patch 80f0b679d6f0: "drm/i915: Add an implementation for
i915_gem_ww_ctx locking, v2." from Aug 19, 2020, leads to the
following Smatch complaint:

    drivers/gpu/drm/i915/gem/i915_gem_object.h:130 __i915_gem_object_lock()
    error: we previously assumed 'ww' could be null (see line 122)

drivers/gpu/drm/i915/gem/i915_gem_object.h
   113  static inline int __i915_gem_object_lock(struct drm_i915_gem_object *obj,
   114                                           struct i915_gem_ww_ctx *ww,
   115                                           bool intr)
   116  {
   117          int ret;
   118  
   119          if (intr)
   120                  ret = dma_resv_lock_interruptible(obj->base.resv, ww ? &ww->ctx : NULL);
                                                                          ^^^^^^^^^^^^^
   121		else
   122			ret = dma_resv_lock(obj->base.resv, ww ? &ww->ctx : NULL);
                                                            ^^^^^^^^^^^^
Checks for NULL.

   123	
   124		if (!ret && ww)
   125			list_add_tail(&obj->obj_link, &ww->obj_list);
   126		if (ret == -EALREADY)
   127			ret = 0;
   128	
   129		if (ret == -EDEADLK)
   130			ww->contended = obj;
                        ^^^^^^^^^^^^^
Unchecked dereference.

   131	
   132		return ret;

regards,
dan carpenter


More information about the Intel-gfx mailing list