[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1480777902-7648-1-git-send-email-bianpan2016@163.com>
Date: Sat, 3 Dec 2016 23:11:42 +0800
From: Pan Bian <bianpan2016@....com>
To: Dave Airlie <airlied@...hat.com>, David Airlie <airlied@...ux.ie>,
Gustavo Padovan <gustavo.padovan@...labora.co.uk>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Sumit Semwal <sumit.semwal@...aro.org>,
Sean Paul <seanpaul@...omium.org>,
Christian König <christian.koenig@....com>
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Pan Bian <bianpan2016@....com>
Subject: [PATCH 1/1] gpu: drm: qxl: fix use of uninitialized variable
In function qxl_release_alloc(), when kmalloc() returns a NULL pointer,
it returns value 0 and parameter *ret is uninitialized. 0 means no error
to the callers of qxl_release_alloc(). The callers keep going and will
try to reference the uninitialized variable. This patch fixes the bug,
returning "-ENOMEM" when kmalloc() fails.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188911
Signed-off-by: Pan Bian <bianpan2016@....com>
---
drivers/gpu/drm/qxl/qxl_release.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c
index cd83f05..e6daa70 100644
--- a/drivers/gpu/drm/qxl/qxl_release.c
+++ b/drivers/gpu/drm/qxl/qxl_release.c
@@ -133,7 +133,7 @@ static long qxl_fence_wait(struct fence *fence, bool intr, signed long timeout)
release = kmalloc(size, GFP_KERNEL);
if (!release) {
DRM_ERROR("Out of memory\n");
- return 0;
+ return -ENOMEM;
}
release->base.ops = NULL;
release->type = type;
--
1.9.1
Powered by blists - more mailing lists