lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200527140526.1458215-3-arnd@arndb.de>
Date:   Wed, 27 May 2020 16:05:10 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Jani Nikula <jani.nikula@...ux.intel.com>,
        Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
        Rodrigo Vivi <rodrigo.vivi@...el.com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        Mika Kuoppala <mika.kuoppala@...ux.intel.com>,
        Chris Wilson <chris@...is-wilson.co.uk>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Tvrtko Ursulin <tvrtko.ursulin@...el.com>,
        Matthew Auld <matthew.auld@...el.com>,
        Andi Shyti <andi.shyti@...el.com>,
        intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH 3/3] drm/i915/selftests: avoid bogus maybe-uninitialized warning

gcc has a problem following values through IS_ERR/PTR_ERR macros,
leading to a false-positive warning in allmodconfig, with any
compiler version:

In file included from drivers/gpu/drm/i915/gt/intel_lrc.c:5892:
drivers/gpu/drm/i915/gt/selftest_lrc.c: In function 'create_gpr_client.isra.0':
drivers/gpu/drm/i915/gt/selftest_lrc.c:2902:23: error: 'rq' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This one is hard to avoid without impairing readability or adding a
bugus NULL pointer.

Fixes: c92724de6db1 ("drm/i915/selftests: Try to detect rollback during batchbuffer preemption")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 drivers/gpu/drm/i915/gt/selftest_lrc.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/selftest_lrc.c b/drivers/gpu/drm/i915/gt/selftest_lrc.c
index 824f99c4cc7c..933c3f5adf0a 100644
--- a/drivers/gpu/drm/i915/gt/selftest_lrc.c
+++ b/drivers/gpu/drm/i915/gt/selftest_lrc.c
@@ -2908,23 +2908,25 @@ create_gpr_client(struct intel_engine_cs *engine,
 
 	vma = i915_vma_instance(global->obj, ce->vm, NULL);
 	if (IS_ERR(vma)) {
-		err = PTR_ERR(vma);
+		rq = ERR_CAST(vma);
 		goto out_ce;
 	}
 
 	err = i915_vma_pin(vma, 0, 0, PIN_USER);
-	if (err)
+	if (err) {
+		rq = ERR_PTR(err);
 		goto out_ce;
+	}
 
 	batch = create_gpr_user(engine, vma, offset);
 	if (IS_ERR(batch)) {
-		err = PTR_ERR(batch);
+		rq = ERR_CAST(batch);
 		goto out_vma;
 	}
 
 	rq = intel_context_create_request(ce);
 	if (IS_ERR(rq)) {
-		err = PTR_ERR(rq);
+		rq = ERR_CAST(rq);
 		goto out_batch;
 	}
 
@@ -2946,17 +2948,20 @@ create_gpr_client(struct intel_engine_cs *engine,
 	i915_vma_unlock(batch);
 	i915_vma_unpin(batch);
 
-	if (!err)
+	if (!err) {
 		i915_request_get(rq);
-	i915_request_add(rq);
-
+		i915_request_add(rq);
+	} else {
+		i915_request_add(rq);
+		rq = ERR_PTR(err);
+	}
 out_batch:
 	i915_vma_put(batch);
 out_vma:
 	i915_vma_unpin(vma);
 out_ce:
 	intel_context_put(ce);
-	return err ? ERR_PTR(err) : rq;
+	return rq;
 }
 
 static int preempt_user(struct intel_engine_cs *engine,
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ