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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Found with smatch

Signed-off-by: Mika Kuoppala <mika.kuoppala@xxxxxxxxx>
---
 drivers/gpu/drm/i915/i915_gem_context.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 985c1ed..19fd362 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;
 	}
-- 
1.7.9.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux