[Intel-gfx] [bug report] drm/i915: Live testing for context execution

Dan Carpenter dan.carpenter at oracle.com
Mon Mar 13 12:34:29 UTC 2017


Hello Chris Wilson,

The patch 791ff39ae32a: "drm/i915: Live testing for context
execution" from Feb 13, 2017, leads to the following static checker
warning:

	drivers/gpu/drm/i915/selftests/i915_gem_context.c:347 igt_ctx_exec()
	error: 'file' dereferencing possible ERR_PTR()

drivers/gpu/drm/i915/selftests/i915_gem_context.c
   320  static int igt_ctx_exec(void *arg)
   321  {
   322          struct drm_i915_private *i915 = arg;
   323          struct drm_file *file = mock_file(i915);
                                 ^^^^^^^^^^^^^^^^^^^^^^
We don't check this for IS_ERR().

   324          struct drm_i915_gem_object *obj;
   325          IGT_TIMEOUT(end_time);
   326          LIST_HEAD(objects);
   327          unsigned long ncontexts, ndwords, dw;
   328          bool first_shared_gtt = true;
   329          int err;
   330  
   331          /* Create a few different contexts (with different mm) and write
   332           * through each ctx/mm using the GPU making sure those writes end
   333           * up in the expected pages of our obj.
   334           */
   335  
   336          mutex_lock(&i915->drm.struct_mutex);
   337  
   338          ncontexts = 0;
   339          ndwords = 0;
   340          dw = 0;
   341          while (!time_after(jiffies, end_time)) {
   342                  struct intel_engine_cs *engine;
   343                  struct i915_gem_context *ctx;
   344                  unsigned int id;
   345  
   346                  if (first_shared_gtt) {
   347                          ctx = __create_hw_context(i915, file->driver_priv);
   348                          first_shared_gtt = false;
   349                  } else {
   350                          ctx = i915_gem_create_context(i915, file->driver_priv);
   351                  }
   352                  if (IS_ERR(ctx)) {
   353                          err = PTR_ERR(ctx);
   354                          goto out_unlock;

regards,
dan carpenter


More information about the Intel-gfx mailing list