diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2022-06-15 07:37:41 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2022-06-15 07:37:41 +0000 |
commit | 252c751786fdc7a1ac3f5dd26ce7b9a905b55e94 (patch) | |
tree | e493e0e90167e33714fe80689c40c25ce38d2243 /sys/dev/pci/drm/radeon | |
parent | 62add17ea42d1016721254372aa8de95ba4488f6 (diff) |
drm/radeon: fix a possible null pointer dereference
From Gong Yuanjun
7b7fba107b2c4ec7673d0f45bdbb9d1af697d9b9 in linux 5.15.y/5.15.47
a2b28708b645c5632dc93669ab06e97874c8244f in mainline linux
Diffstat (limited to 'sys/dev/pci/drm/radeon')
-rw-r--r-- | sys/dev/pci/drm/radeon/radeon_connectors.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/radeon/radeon_connectors.c b/sys/dev/pci/drm/radeon/radeon_connectors.c index 1546abcadac..d157bb9072e 100644 --- a/sys/dev/pci/drm/radeon/radeon_connectors.c +++ b/sys/dev/pci/drm/radeon/radeon_connectors.c @@ -473,6 +473,8 @@ static struct drm_display_mode *radeon_fp_native_mode(struct drm_encoder *encode native_mode->vdisplay != 0 && native_mode->clock != 0) { mode = drm_mode_duplicate(dev, native_mode); + if (!mode) + return NULL; mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; drm_mode_set_name(mode); @@ -487,6 +489,8 @@ static struct drm_display_mode *radeon_fp_native_mode(struct drm_encoder *encode * simpler. */ mode = drm_cvt_mode(dev, native_mode->hdisplay, native_mode->vdisplay, 60, true, false, false); + if (!mode) + return NULL; mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER; DRM_DEBUG_KMS("Adding cvt approximation of native panel mode %s\n", mode->name); } |