[PATCH v2 15/33] drm/modes: Bail out of named mode parsing if empty

Maxime Ripard maxime at cerno.tech
Thu Sep 22 14:25:32 UTC 2022


If the name we want to parse has a length of zero, there's no need to
compare it to the list of all the named modes we support, we can return
straight away.

Signed-off-by: Maxime Ripard <maxime at cerno.tech>

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index b1e800e4ed60..8d629fbb1047 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -2235,6 +2235,9 @@ static int drm_mode_parse_cmdline_named_mode(const char *name,
 {
 	unsigned int i;
 
+	if (!name_end)
+		return 0;
+
 	/*
 	 * We're sure we're a named mode at that point, iterate over the
 	 * list of modes we're aware of.

-- 
b4 0.10.0


More information about the dri-devel mailing list