drm/radeon: fix a possible null pointer dereference
authorjsg <jsg@openbsd.org>
Thu, 30 Nov 2023 02:33:55 +0000 (02:33 +0000)
committerjsg <jsg@openbsd.org>
Thu, 30 Nov 2023 02:33:55 +0000 (02:33 +0000)
From Ma Ke
16fa59e273f8eb20ececeb570ab41c9d3d791429 in linux-6.1.y/6.1.64
2c1fe3c480f9e1deefd50d4b18be4a046011ee1f in mainline linux

sys/dev/pci/drm/radeon/radeon_connectors.c

index f7431d2..5837af5 100644 (file)
@@ -1122,6 +1122,8 @@ static int radeon_tv_get_modes(struct drm_connector *connector)
        else {
                /* only 800x600 is supported right now on pre-avivo chips */
                tv_mode = drm_cvt_mode(dev, 800, 600, 60, false, false, false);
+               if (!tv_mode)
+                       return 0;
                tv_mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
                drm_mode_probed_add(connector, tv_mode);
        }