⬢ DragonFlyBSD Kernel Audit
DF-4373 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/amd/display/dc/dce/dce_transform.c
+++ b/sys/dev/drm/amd/display/dc/dce/dce_transform.c
@@ -702,6 +702,19 @@
 	}
 
 	ASSERT(pixels_per_entries);
+
+	/*
+	 * Degenerate line-buffer configuration or (more importantly) a
+	 * zero/negative pixel width handed down from resource_build_scaling()
+	 * when a plane's recout collapses to an empty rectangle (plane
+	 * positioned flush outside the stream destination window - amdgpu_dm
+	 * does not clip plane rects to the CRTC). ASSERT() is WARN_ON-only,
+	 * so guard the division itself: report that no lines are supported,
+	 * which makes dce_transform_get_optimal_number_of_taps() fail
+	 * validation cleanly instead of dividing by zero (#DE panic).
+	 */
+	if (pixels_per_entries == 0 || pixel_width <= 0)
+		return 0;
 
 	max_pixels_supports =
 			pixels_per_entries *