* [PATCH 1/1] gpu: drm: qxl: fix use of uninitialized variable
@ 2016-12-03 15:11 Pan Bian
2016-12-05 18:19 ` Sean Paul
0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2016-12-03 15:11 UTC (permalink / raw)
To: Dave Airlie, David Airlie, Gustavo Padovan, Masahiro Yamada,
Daniel Vetter, Sumit Semwal, Sean Paul, Christian König
Cc: dri-devel, linux-kernel, Pan Bian
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] gpu: drm: qxl: fix use of uninitialized variable
2016-12-03 15:11 [PATCH 1/1] gpu: drm: qxl: fix use of uninitialized variable Pan Bian
@ 2016-12-05 18:19 ` Sean Paul
0 siblings, 0 replies; 2+ messages in thread
From: Sean Paul @ 2016-12-05 18:19 UTC (permalink / raw)
To: Pan Bian
Cc: Dave Airlie, David Airlie, Gustavo Padovan, Masahiro Yamada,
Daniel Vetter, Sumit Semwal, Christian König, dri-devel,
Linux Kernel Mailing List
On Sat, Dec 3, 2016 at 10:11 AM, Pan Bian <bianpan2016@163.com> wrote:
> 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>
Applied to drm-misc, with subject prefix tweak s_gpu: drm: qxl_drm/qxl_
Thanks!
Sean
> ---
> 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
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-05 18:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-03 15:11 [PATCH 1/1] gpu: drm: qxl: fix use of uninitialized variable Pan Bian
2016-12-05 18:19 ` Sean Paul
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).