Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1299093

[PATCH] qxl: correctly handling failed allocation

From Insu Yun <wuninsu@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] qxl: correctly handling failed allocation
Date 2015-12-29 20:20 +0100
Message-ID <qL7Ym-4Dn-13@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Since kmalloc can be failed in memory pressure, 
when fails, return error code.

Signed-off-by: Insu Yun <wuninsu@gmail.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..2e99854 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->memslots)
+		return -ENOMEM;
+
 	idr_init(&qdev->release_idr);
 	spin_lock_init(&qdev->release_idr_lock);
 	spin_lock_init(&qdev->release_lock);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] qxl: correctly handling failed allocation Insu Yun <wuninsu@gmail.com> - 2015-12-29 20:20 +0100
  Re: [PATCH] qxl: correctly handling failed allocation kbuild test robot <lkp@intel.com> - 2015-12-29 20:30 +0100

csiph-web