summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-09-13 11:44:21 +0200
committerMichel Dänzer <michel@daenzer.net>2018-09-13 11:44:21 +0200
commit6572be49b713a26eca14f16e1854cabf28101288 (patch)
treedcc670c725a2bfea0509e9b51d6528afed98ea35
parentca5eb9894fff153c0a1df7bdc4a4745713309e27 (diff)
Bail from drmmode_cm_init if there's no CRTC
We would crash due to dereferencing the NULL mode_res->crtc pointer. Bugzilla: https://bugs.freedesktop.org/107913 Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--src/drmmode_display.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 6ef6a98..cbda8ad 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -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.
*/