drm/amd/display: Stop amdgpu_dm initialize when stream nums greater than 6
authorjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 08:45:55 +0000 (08:45 +0000)
committerjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 08:45:55 +0000 (08:45 +0000)
From Hersen Wu
94cb77700fa4ae6200486bfa0ba2ac547534afd2 in linux-6.6.y/6.6.50
84723eb6068c50610c5c0893980d230d7afa2105 in mainline linux

sys/dev/pci/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 6a3d1f4..1c7289d 100644 (file)
@@ -4361,7 +4361,10 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
 
        /* There is one primary plane per CRTC */
        primary_planes = dm->dc->caps.max_streams;
-       ASSERT(primary_planes <= AMDGPU_MAX_PLANES);
+       if (primary_planes > AMDGPU_MAX_PLANES) {
+               DRM_ERROR("DM: Plane nums out of 6 planes\n");
+               return -EINVAL;
+       }
 
        /*
         * Initialize primary planes, implicit planes for legacy IOCTLS.