drm: modes: Revert cc344980c767 "replace simple_strtoul by kstrtouint"
Subsystems (2)
PATCH 1/1 drm: modes: Revert cc344980c767 "replace simple_strtoul by kstrtouint"
My latest commit introduce some case where a valid mode, could be rejected.simple_strtox functions stop at first non-digit character, but kstrtox not.
So args like "video=HDMI-A-1:720x480-16@60" will be reject when checking 16@.
Discussions about this change comes to the conclusion that the best solution is to revert my commit cc344980c76748e57c9c03100c2a14d36ab00334.
--- drivers/gpu/drm/drm_modes.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/gpu/drm/drm_modes.c +5 -11
@@ -1230,7 +1230,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,unsigned int xres =0 , yres =0 , bpp =32 , refresh =0 ;bool yres_specified = false, cvt = false, rb = false;bool interlace = false, margins = false, was_digit = false; -int i, err; +int i;enum drm_connector_force force =DRM_FORCE_UNSPECIFIED ;#ifdef CONFIG_FB
@@ -1250,9 +1250,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,case '@' :if (!refresh_specified && !bpp_specified && !yres_specified && !cvt && !rb && was_digit) { - err =kstrtouint (&name[i +1 ],10 , &refresh); -if (err) -return false; + refresh =simple_strtol (&name[i+1 ],NULL ,10 ); refresh_specified = true; was_digit = false; }else
@@ -1261,9 +1259,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,case '-' :if (!bpp_specified && !yres_specified && !cvt && !rb && was_digit) { - err =kstrtouint (&name[i +1 ],10 , &bpp); -if (err) -return false; + bpp =simple_strtol (&name[i+1 ],NULL ,10 ); bpp_specified = true; was_digit = false; }else
@@ -1271,9 +1267,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,break ;case 'x' :if (!yres_specified && was_digit) { - err =kstrtouint (&name[i +1 ],10 , &yres); -if (err) -return false; + yres =simple_strtol (&name[i+1 ],NULL ,10 ); yres_specified = true; was_digit = false; }else
@@ -1496,4 +1490,4 @@ int drm_mode_convert_umode(struct drm_display_mode *out, out:return ret; -} +}
Signature · 6 lines
2.4.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter
AppliedQuoted 11 lines · LABBE Corentin
My latest commit introduce some case where a valid mode, could be rejected.
simple_strtoxfunctions stop at first non-digit character, but kstrtox not.
So args like "video=HDMI-A-1:720x480-16@60" will be reject when checking 16@.Discussions about this change comes to the conclusion that the best solution is to revert my commit
cc344980c76748e57c9c03100c2a14d36ab00334.Signed-off-by LABBE Corentin <[email protected]>
Queued for -next, thanks for the patch.
-Daniel
Quoted 64 lines
--- drivers/gpu/drm/drm_modes.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)drivers/gpu/drm/drm_modes.c +5
-11@@ -1230,7 +1230,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,unsigned int xres =0 , yres =0 , bpp =32 , refresh =0 ;bool yres_specified = false, cvt = false, rb = false;bool interlace = false, margins = false, was_digit = false; -int i, err; +int i;enum drm_connector_force force =DRM_FORCE_UNSPECIFIED ;#ifdef CONFIG_FB @@ -1250,9 +1250,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,case '@' :if (!refresh_specified && !bpp_specified && !yres_specified && !cvt && !rb && was_digit) { - err =kstrtouint (&name[i +1 ],10 , &refresh); -if (err) -return false; + refresh =simple_strtol (&name[i+1 ],NULL ,10 ); refresh_specified = true; was_digit = false; }else @@ -1261,9 +1259,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,case '-' :if (!bpp_specified && !yres_specified && !cvt && !rb && was_digit) { - err =kstrtouint (&name[i +1 ],10 , &bpp); -if (err) -return false; + bpp =simple_strtol (&name[i+1 ],NULL ,10 ); bpp_specified = true; was_digit = false; }else @@ -1271,9 +1267,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option,break ;case 'x' :if (!yres_specified && was_digit) { - err =kstrtouint (&name[i +1 ],10 , &yres); -if (err) -return false; + yres =simple_strtol (&name[i+1 ],NULL ,10 ); yres_specified = true; was_digit = false; }else @@ -1496,4 +1490,4 @@ int drm_mode_convert_umode(struct drm_display_mode *out, out:return ret; -} +}Signature · 6 lines
2.4.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel