diff mbox

[0152/1094] drm/i915: check for oom when allocating private_default_ctx

Message ID 1413889294-31328-153-git-send-email-dheerajx.s.jamwal@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dheeraj Jamwal Oct. 21, 2014, 10:45 a.m. UTC
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>

Found with smatch

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 7f76b23aae21890b28cf415a4f8123523a7abb24)

Signed-off-by: Dheeraj Jamwal <dheerajx.s.jamwal@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_context.c |    4 ++++
 1 file changed, 4 insertions(+)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 20bae94..880c3a7 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -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;
 	}