[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ef38255f-fe4a-3ba5-e828-bac4d9957cdb@linux.intel.com>
Date: Wed, 25 Aug 2021 11:56:35 +0200
From: Thomas Hellström
<thomas.hellstrom@...ux.intel.com>
To: Nathan Chancellor <nathan@...nel.org>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>
Cc: Jason Ekstrand <jason@...kstrand.net>,
Matthew Auld <matthew.auld@...el.com>,
"Michael J. Ruhl" <michael.j.ruhl@...el.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com,
llvm@...ts.linux.dev, Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH 1/3] drm/i915/selftests: Do not use import_obj
uninitialized
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@...cle.com>
> Signed-off-by: Nathan Chancellor <nathan@...nel.org>
Patch looks good to me.
Reviewed-by: Thomas Hellström <thomas.hellstrom@...ux.intel.com>
Powered by blists - more mailing lists