46 lines
1.6 KiB
Diff
46 lines
1.6 KiB
Diff
From e0fc4404a165a8262a86cec6305108b76a3c7a5c Mon Sep 17 00:00:00 2001
|
||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||
Date: Sat, 25 Oct 2025 16:27:34 -0700
|
||
Subject: [PATCH xserver 09/31] glamor: handle allocation failure in
|
||
glamor_create_pixmap()
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
Reported by gcc 15.1:
|
||
|
||
../glamor/glamor.c: In function ‘glamor_create_pixmap’:
|
||
../glamor/glamor.c:233:23: warning: potential null pointer dereference
|
||
[-Wnull-dereference]
|
||
233 | pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
|
||
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
|
||
../glamor/glamor.c:228:26: warning: potential null pointer dereference
|
||
[-Wnull-dereference]
|
||
228 | pixmap_priv->is_cbcr = (GLAMOR_CREATE_FORMAT_CBCR & usage) == GLAMOR_CREATE_FORMAT_CBCR;
|
||
|
||
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||
(cherry picked from commit cc647f23679ae2beb7b971aa7d1203375c25bb55)
|
||
(cherry picked from commit 3611931eb3cec6e89df298bebab88beac89644aa)
|
||
|
||
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2151>
|
||
---
|
||
glamor/glamor.c | 3 +++
|
||
1 file changed, 3 insertions(+)
|
||
|
||
diff --git a/glamor/glamor.c b/glamor/glamor.c
|
||
index 7c88d7e18..b2bd34f39 100644
|
||
--- a/glamor/glamor.c
|
||
+++ b/glamor/glamor.c
|
||
@@ -223,6 +223,9 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
||
else
|
||
pixmap = fbCreatePixmap(screen, 0, 0, depth, usage);
|
||
|
||
+ if (!pixmap)
|
||
+ return NullPixmap;
|
||
+
|
||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||
|
||
pixmap_priv->is_cbcr = (GLAMOR_CREATE_FORMAT_CBCR & usage) == GLAMOR_CREATE_FORMAT_CBCR;
|
||
--
|
||
2.54.0
|
||
|