[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1454627873-26358-1-git-send-email-wuninsu@gmail.com>
Date: Thu, 4 Feb 2016 18:17:53 -0500
From: Insu Yun <wuninsu@...il.com>
To: airlied@...ux.ie, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Cc: taesoo@...ech.edu, yeongjin.jang@...ech.edu, insu@...ech.edu,
changwoo@...ech.edu, Insu Yun <wuninsu@...il.com>
Subject: [PATCH] qxl: handling failed allocation
Since kmalloc can be failed in memory pressure,
check and return error code
otherwise NULL deference could be happened
Signed-off-by: Insu Yun <wuninsu@...il.com>
---
drivers/gpu/drm/qxl/qxl_kms.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/qxl/qxl_kms.c b/drivers/gpu/drm/qxl/qxl_kms.c
index b2977a1..02d26b3 100644
--- a/drivers/gpu/drm/qxl/qxl_kms.c
+++ b/drivers/gpu/drm/qxl/qxl_kms.c
@@ -221,6 +221,9 @@ static int qxl_device_init(struct qxl_device *qdev,
kmalloc(qdev->n_mem_slots * sizeof(struct qxl_memslot),
GFP_KERNEL);
+ if (!qdev->mem_slots)
+ return -ENOMEM;
+
idr_init(&qdev->release_idr);
spin_lock_init(&qdev->release_idr_lock);
spin_lock_init(&qdev->release_lock);
--
1.9.1
Powered by blists - more mailing lists