[Intel-gfx] [bug report] drm/i915/selftests: Teach igt_gpu_fill_dw() to take intel_context

Dan Carpenter dan.carpenter at oracle.com
Tue Aug 27 09:40:16 UTC 2019


Hello Chris Wilson,

The patch 75b974a859e5: "drm/i915/selftests: Teach igt_gpu_fill_dw()
to take intel_context" from Aug 24, 2019, leads to the following
static checker warning:

	drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c:402 igt_ctx_exec()
	error: 'ce' dereferencing possible ERR_PTR()

drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c
   388                  dw = 0;
   389                  while (!time_after(jiffies, end_time)) {
   390                          struct i915_gem_context *ctx;
   391                          struct intel_context *ce;
   392  
   393                          ctx = live_context(i915, file);
   394                          if (IS_ERR(ctx)) {
   395                                  err = PTR_ERR(ctx);
   396                                  goto out_unlock;
   397                          }
   398  
   399                          ce = i915_gem_context_get_engine(ctx, engine->legacy_idx);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
New assignment.  Smatch thinks it can be ERR_PTR(-EINVAL)

   400  
   401                          if (!obj) {
   402                                  obj = create_test_object(ce->vm, file, &objects);
                                                                 ^^^^^^
Dereference.

   403                                  if (IS_ERR(obj)) {
   404                                          err = PTR_ERR(obj);
   405                                          intel_context_put(ce);
   406                                          goto out_unlock;
   407                                  }
   408                          }
   409  
   410                          err = gpu_fill(ce, obj, dw);
   411                          intel_context_put(ce);
   412  
   413                          if (err) {
   414                                  pr_err("Failed to fill dword %lu [%lu/%lu] with gpu (%s) in ctx %u [full-ppgtt? %s], err=%d\n",
   415                                         ndwords, dw, max_dwords(obj),
   416                                         engine->name, ctx->hw_id,
   417                                         yesno(!!ctx->vm), err);
   418                                  goto out_unlock;
   419                          }

See also:

drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c:410 igt_ctx_exec() error: 'ce' dereferencing possible ERR_PTR()
drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c:528 igt_shared_ctx_exec() error: 'ce' dereferencing possible ERR_PTR()
drivers/gpu/drm/i915/gem/selftests/i915_gem_context.c:534 igt_shared_ctx_exec() error: 'ce' dereferencing possible ERR_PTR()

regards,
dan carpenter


More information about the Intel-gfx mailing list