[PATCH v2 2/2] drm/mode_config: Make drm_mode_config.(max|min)_(width|height) unsigned

Lyude Paul lyude at redhat.com
Mon Mar 31 22:23:55 UTC 2025


It doesn't make much sense to allow devices to specify their min/max
resolution as signed integers, and in Rust with CONFIG_RUST_OVERFLOW_CHECKS
enabled this provides us actual over/underflow checks. Similarly, it
doesn't really make much sense for us to allow devices to specify their
minimum/maximum resolution as signed.

Signed-off-by: Lyude Paul <lyude at redhat.com>
Reviewed-by: Maxime Ripard <mripard at kernel.org>
Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Cc: Thomas Zimmermann <tzimmermann at suse.de>

---

V2:
* No functional changes, just update the commit message w/r/t Thomas's
  comments.

Signed-off-by: Lyude Paul <lyude at redhat.com>
---
 include/drm/drm_mode_config.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 271765e2e9f2d..4b8f0370b79bf 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -532,8 +532,8 @@ struct drm_mode_config {
 	 */
 	struct list_head privobj_list;
 
-	int min_width, min_height;
-	int max_width, max_height;
+	unsigned int min_width, min_height;
+	unsigned int max_width, max_height;
 	const struct drm_mode_config_funcs *funcs;
 
 	/* output poll support */
-- 
2.48.1



More information about the dri-devel mailing list