[Intel-gfx] [PATCH] Fix NULL pointer found by static analysis

Steve Hampson steven.t.hampson at intel.com
Wed Sep 23 04:40:54 UTC 2020


A static analysis tool has reveiled a NULL pointer error in
__i915_gem_object_lock.  This appears to be correct as many calls
pass a NULL into the ww parameter.

Signed-off-by: Steve Hampson <steven.t.hampson at intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_object.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h b/drivers/gpu/drm/i915/gem/i915_gem_object.h
index d46db8d8f38e..9b18ead42991 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
@@ -126,7 +126,7 @@ static inline int __i915_gem_object_lock(struct drm_i915_gem_object *obj,
 	if (ret == -EALREADY)
 		ret = 0;
 
-	if (ret == -EDEADLK)
+	if (ret == -EDEADLK && ww)
 		ww->contended = obj;
 
 	return ret;
-- 
2.21.0



More information about the Intel-gfx mailing list