From: Pan Bian <bianpan2016@163.com>
To: "Dave Airlie" <airlied@redhat.com>,
"David Airlie" <airlied@linux.ie>,
"Gustavo Padovan" <gustavo.padovan@collabora.co.uk>,
"Masahiro Yamada" <yamada.masahiro@socionext.com>,
"Daniel Vetter" <daniel.vetter@ffwll.ch>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Sean Paul" <seanpaul@chromium.org>,
"Christian König" <christian.koenig@amd.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Pan Bian <bianpan2016@163.com>
Subject: [PATCH 1/1] gpu: drm: qxl: fix use of uninitialized variable
Date: Sat, 3 Dec 2016 23:11:42 +0800 [thread overview]
Message-ID: <1480777902-7648-1-git-send-email-bianpan2016@163.com> (raw)
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@163.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
next reply other threads:[~2016-12-03 15:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-03 15:11 Pan Bian [this message]
2016-12-05 18:19 ` [PATCH 1/1] gpu: drm: qxl: fix use of uninitialized variable Sean Paul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1480777902-7648-1-git-send-email-bianpan2016@163.com \
--to=bianpan2016@163.com \
--cc=airlied@linux.ie \
--cc=airlied@redhat.com \
--cc=christian.koenig@amd.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavo.padovan@collabora.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=seanpaul@chromium.org \
--cc=sumit.semwal@linaro.org \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).