From: Mika Kuoppala Date: Fri, 31 Jan 2014 15:00:28 +0000 (+0200) Subject: drm/i915: check for oom when allocating private_default_ctx X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7f76b23aae21890b28cf415a4f8123523a7abb24;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git drm/i915: check for oom when allocating private_default_ctx Found with smatch Signed-off-by: Mika Kuoppala Signed-off-by: Daniel Vetter --- diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index 985c1ed9f3fc..19fd3629795c 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; }