All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: maarten.lankhorst@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [bug report] drm/i915: Add an implementation for i915_gem_ww_ctx locking, v2.
Date: Fri, 11 Sep 2020 14:34:41 +0300	[thread overview]
Message-ID: <20200911113441.GD367487@mwanda> (raw)

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
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

                 reply	other threads:[~2020-09-11 11:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200911113441.GD367487@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.