]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: check for oom when allocating private_default_ctx
authorMika Kuoppala <mika.kuoppala@linux.intel.com>
Fri, 31 Jan 2014 15:00:28 +0000 (17:00 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 4 Feb 2014 11:10:26 +0000 (12:10 +0100)
Found with smatch

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_context.c

index 985c1ed9f3fc970ef91614e3552622d18d6c9a59..19fd3629795c5a2075664c8313c027983730085f 100644 (file)
@@ -489,6 +489,10 @@ int i915_gem_context_open(struct drm_device *dev, struct drm_file *file)
                /* Cheat for hang stats */
                file_priv->private_default_ctx =
                        kzalloc(sizeof(struct i915_hw_context), GFP_KERNEL);
+
+               if (file_priv->private_default_ctx == NULL)
+                       return -ENOMEM;
+
                file_priv->private_default_ctx->vm = &dev_priv->gtt.base;
                return 0;
        }