From 4a46ff1b35f6172500f706ad490cd8ce5f33f1df Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 17 Sep 2025 11:19:34 +0100 Subject: [PATCH] drm/modes: Handle reflect_[xy] in the middle of the cmd line The command line parser was looking for an "=" before the "," separator. If the command line had reflect_[xy] before another option which took a parameter, it would find the "=" from the second option and assume it was associated with the reflect option, generally leading to a parsing failure. Handle this case by looking for both "," and "=", and taking the first instance. Signed-off-by: Dave Stevenson --- drivers/gpu/drm/drm_modes.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index e72f855fc495..c9f210ef87d0 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2172,12 +2172,15 @@ static int drm_mode_parse_cmdline_options(const char *str, option = str; do { + sep = strchr(option, ','); delim = strchr(option, '='); if (!delim) { - delim = strchr(option, ','); - - if (!delim) + if (!sep) delim = option + strlen(option); + else + delim = sep; + } else if (sep && sep < delim) { + delim = sep; } if (!strncmp(option, "rotate", delim - option)) {