All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Nathan Chancellor <nathan@kernel.org>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>,
	Matthew Auld <matthew.auld@intel.com>,
	"Michael J. Ruhl" <michael.j.ruhl@intel.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com,
	llvm@lists.linux.dev, Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [Intel-gfx] [PATCH 1/3] drm/i915/selftests: Do not use import_obj uninitialized
Date: Wed, 25 Aug 2021 11:56:35 +0200	[thread overview]
Message-ID: <ef38255f-fe4a-3ba5-e828-bac4d9957cdb@linux.intel.com> (raw)
In-Reply-To: <20210824225427.2065517-2-nathan@kernel.org>


On 8/25/21 12:54 AM, Nathan Chancellor wrote:
> Clang warns a couple of times:
>
> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:63:6: warning:
> variable 'import_obj' is used uninitialized whenever 'if' condition is
> true [-Wsometimes-uninitialized]
>          if (import != &obj->base) {
>              ^~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:80:22: note:
> uninitialized use occurs here
>          i915_gem_object_put(import_obj);
>                              ^~~~~~~~~~
> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:63:2: note: remove
> the 'if' if its condition is always false
>          if (import != &obj->base) {
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:38:46: note:
> initialize the variable 'import_obj' to silence this warning
>          struct drm_i915_gem_object *obj, *import_obj;
>                                                      ^
>                                                       = NULL
>
> Shuffle the import_obj initialization above these if statements so that
> it is not used uninitialized.
>
> Fixes: d7b2cb380b3a ("drm/i915/gem: Correct the locking and pin pattern for dma-buf (v8)")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Patch looks good to me.

Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>



WARNING: multiple messages have this Message-ID (diff)
From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Nathan Chancellor <nathan@kernel.org>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>,
	Matthew Auld <matthew.auld@intel.com>,
	"Michael J. Ruhl" <michael.j.ruhl@intel.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com,
	llvm@lists.linux.dev, Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH 1/3] drm/i915/selftests: Do not use import_obj uninitialized
Date: Wed, 25 Aug 2021 11:56:35 +0200	[thread overview]
Message-ID: <ef38255f-fe4a-3ba5-e828-bac4d9957cdb@linux.intel.com> (raw)
In-Reply-To: <20210824225427.2065517-2-nathan@kernel.org>


On 8/25/21 12:54 AM, Nathan Chancellor wrote:
> Clang warns a couple of times:
>
> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:63:6: warning:
> variable 'import_obj' is used uninitialized whenever 'if' condition is
> true [-Wsometimes-uninitialized]
>          if (import != &obj->base) {
>              ^~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:80:22: note:
> uninitialized use occurs here
>          i915_gem_object_put(import_obj);
>                              ^~~~~~~~~~
> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:63:2: note: remove
> the 'if' if its condition is always false
>          if (import != &obj->base) {
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c:38:46: note:
> initialize the variable 'import_obj' to silence this warning
>          struct drm_i915_gem_object *obj, *import_obj;
>                                                      ^
>                                                       = NULL
>
> Shuffle the import_obj initialization above these if statements so that
> it is not used uninitialized.
>
> Fixes: d7b2cb380b3a ("drm/i915/gem: Correct the locking and pin pattern for dma-buf (v8)")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Patch looks good to me.

Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>



  reply	other threads:[~2021-08-25  9:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 22:54 [Intel-gfx] [PATCH 0/3] drm/i915: Enable -Wsometimes-uninitialized Nathan Chancellor
2021-08-24 22:54 ` Nathan Chancellor
2021-08-24 22:54 ` [Intel-gfx] [PATCH 1/3] drm/i915/selftests: Do not use import_obj uninitialized Nathan Chancellor
2021-08-24 22:54   ` Nathan Chancellor
2021-08-25  9:56   ` Thomas Hellström [this message]
2021-08-25  9:56     ` Thomas Hellström
2021-08-24 22:54 ` [Intel-gfx] [PATCH 2/3] drm/i915/selftests: Always initialize err in igt_dmabuf_import_same_driver_lmem() Nathan Chancellor
2021-08-24 22:54   ` Nathan Chancellor
2021-08-25  9:57   ` [Intel-gfx] " Thomas Hellström
2021-08-25  9:57     ` Thomas Hellström
2021-08-24 22:54 ` [Intel-gfx] [PATCH 3/3] drm/i915: Enable -Wsometimes-uninitialized Nathan Chancellor
2021-08-24 22:54   ` Nathan Chancellor
2021-09-14 15:17   ` [Intel-gfx] " Nick Desaulniers
2021-09-14 15:17     ` Nick Desaulniers
2021-08-25 18:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2021-08-26  0:31 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2021-09-13 17:55 ` [Intel-gfx] [PATCH 0/3] " Nathan Chancellor
2021-09-13 17:55   ` Nathan Chancellor
2021-09-14 17:10   ` [Intel-gfx] " Jani Nikula
2021-09-14 17:10     ` Jani Nikula
2021-09-14 19:53     ` [Intel-gfx] " Nathan Chancellor
2021-09-14 19:53       ` Nathan Chancellor

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=ef38255f-fe4a-3ba5-e828-bac4d9957cdb@linux.intel.com \
    --to=thomas.hellstrom@linux.intel.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jason@jlekstrand.net \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=matthew.auld@intel.com \
    --cc=michael.j.ruhl@intel.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=rodrigo.vivi@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.