Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16571a8a authored by Pan Bian's avatar Pan Bian Committed by Sean Paul
Browse files

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: default avatarPan Bian <bianpan2016@163.com>
[seanpaul fixed up subject prefix]
Signed-off-by: default avatarSean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1480777902-7648-1-git-send-email-bianpan2016@163.com
parent 48d98316
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ qxl_release_alloc(struct qxl_device *qdev, int type,
	release = kmalloc(size, GFP_KERNEL);
	if (!release) {
		DRM_ERROR("Out of memory\n");
		return 0;
		return -ENOMEM;
	}
	release->base.ops = NULL;
	release->type = type;