Skip to contentSkip to conversation

Bail from drmmode_cm_init if there's no CRTC

PATCH In review Michel Dänzer 2 participants 2 messages Sep 13, 2018 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bail from drmmode_cm_init if there's no CRTC

From: Michel Dänzer <[email protected]>

We would crash due to dereferencing the NULL mode_res->crtc pointer.

Bugzilla: https://bugs.freedesktop.org/107913

---
 src/drmmode_display.c | 3 +++
 1 file changed, 3 insertions(+)
src/drmmode_display.c +3 -0
index 6ef6a98e2..cbda8ad35 100644
@@ -3198,6 +3198,9 @@ static void drmmode_cm_init(int drm_fd, drmmode_ptr drmmode,
 	memset(drmmode->cm_prop_ids, 0, sizeof(drmmode->cm_prop_ids));
 	drmmode->gamma_lut_size = drmmode->degamma_lut_size = 0;
 
+	if (!mode_res->crtcs)
+		return;
+
 	/* AMD hardware has color management support on all pipes. It is
 	 * therefore sufficient to only check the first CRTC.
 	 */
Signature · 6 lines
2.19.0.rc2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180913094729.2355-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by
#2 lore raw

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Michel Dänzer <[email protected]>
Sent: Thursday, September 13, 2018 5:47:29 AM
To: [email protected]
Subject: [PATCH xf86-video-amdgpu] Bail from drmmode_cm_init if there's no CRTC

From: Michel Dänzer <[email protected]>

We would crash due to dereferencing the NULL mode_res->crtc pointer.

Bugzilla: https://bugs.freedesktop.org/107913

---
 src/drmmode_display.c | 3 +++
 1 file changed, 3 insertions(+)
src/drmmode_display.c +3 -0
index 6ef6a98e2..cbda8ad35 100644
@@ -3198,6 +3198,9 @@ static void drmmode_cm_init(int drm_fd, drmmode_ptr drmmode,
         memset(drmmode->cm_prop_ids, 0, sizeof(drmmode->cm_prop_ids));
         drmmode->gamma_lut_size = drmmode->degamma_lut_size = 0;
 
+       if (!mode_res->crtcs)
+               return;
+
         /* AMD hardware has color management support on all pipes. It is
          * therefore sufficient to only check the first CRTC.
          */

--
2.19.0.rc2

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx