All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/display: Check source height is > 0
@ 2022-12-27  5:53 ` Drew Davenport
  0 siblings, 0 replies; 24+ messages in thread
From: Drew Davenport @ 2022-12-27  5:53 UTC (permalink / raw)
  To: intel-gfx
  Cc: Drew Davenport, Daniel Vetter, David Airlie, Imre Deak,
	Jani Nikula, Joonas Lahtinen, José Roberto de Souza,
	Juha-Pekka Heikkilä,
	Matt Roper, Rodrigo Vivi, Thomas Zimmermann, Tvrtko Ursulin,
	Ville Syrjälä,
	dri-devel, linux-kernel

The error message suggests that the height of the src rect must be at
least 1. Reject source with height of 0.

Signed-off-by: Drew Davenport <ddavenport@chromium.org>

---
I was investigating some divide-by-zero crash reports on ChromeOS which
pointed to the intel_adjusted_rate function. Further prodding showed
that I could reproduce this in a simple test program if I made src_h
some value less than 1 but greater than 0.

This seemed to be a sensible place to check that the source height is at
least 1. I tried to repro this issue on an amd device I had on hand, and
the configuration was rejected.

Would it make sense to add a check that source dimensions are at least 1
somewhere in core, like in drm_atomic_plane_check? Or is that a valid
use case on some devices, and thus any such check should be done on a
per-driver basis?

Thanks.

 drivers/gpu/drm/i915/display/skl_universal_plane.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/skl_universal_plane.c b/drivers/gpu/drm/i915/display/skl_universal_plane.c
index 4b79c2d2d6177..9b172a1e90deb 100644
--- a/drivers/gpu/drm/i915/display/skl_universal_plane.c
+++ b/drivers/gpu/drm/i915/display/skl_universal_plane.c
@@ -1627,7 +1627,7 @@ static int skl_check_main_surface(struct intel_plane_state *plane_state)
 	u32 offset;
 	int ret;
 
-	if (w > max_width || w < min_width || h > max_height) {
+	if (w > max_width || w < min_width || h > max_height || h < 1) {
 		drm_dbg_kms(&dev_priv->drm,
 			    "requested Y/RGB source size %dx%d outside limits (min: %dx1 max: %dx%d)\n",
 			    w, h, min_width, max_width, max_height);
-- 
2.39.0.314.g84b9a713c41-goog


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2023-01-13 11:13 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-27  5:53 [PATCH] drm/i915/display: Check source height is > 0 Drew Davenport
2022-12-27  5:53 ` [Intel-gfx] " Drew Davenport
2022-12-27  5:53 ` Drew Davenport
2022-12-27 15:42 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2022-12-27 17:55 ` [Intel-gfx] [PATCH] " Teres Alexis, Alan Previn
2022-12-27 17:55   ` Teres Alexis, Alan Previn
2022-12-27 17:55   ` Teres Alexis, Alan Previn
2023-01-11 18:47   ` Drew Davenport
2023-01-11 18:47     ` Drew Davenport
2023-01-11 18:47     ` Drew Davenport
2022-12-27 19:34 ` [Intel-gfx] ✓ Fi.CI.IGT: success for " Patchwork
2023-01-03 10:42 ` [PATCH] " Juha-Pekka Heikkila
2023-01-03 10:42   ` [Intel-gfx] " Juha-Pekka Heikkila
2023-01-03 10:42   ` Juha-Pekka Heikkila
2023-01-10 20:30   ` Drew Davenport
2023-01-10 20:30     ` Drew Davenport
2023-01-10 20:30     ` [Intel-gfx] " Drew Davenport
2023-01-03 10:56 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/display: Check source height is > 0 (rev2) Patchwork
2023-01-12 18:28 ` [PATCH] drm/i915/display: Check source height is > 0 Ville Syrjälä
2023-01-12 18:28   ` Ville Syrjälä
2023-01-12 18:28   ` [Intel-gfx] " Ville Syrjälä
2023-01-13 11:06   ` Juha-Pekka Heikkila
2023-01-13 11:06     ` Juha-Pekka Heikkila
2023-01-13 11:06     ` Juha-Pekka Heikkila

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.