Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1289542 > unrolled thread

[PATCH] drm: modes: Revert cc344980c767 "replace simple_strtoul by kstrtouint"

Started byLABBE Corentin <clabbe.montjoie@gmail.com>
First post2015-12-11 14:00 +0100
Last post2015-12-11 17:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm: modes: Revert cc344980c767 "replace simple_strtoul by kstrtouint" LABBE Corentin <clabbe.montjoie@gmail.com> - 2015-12-11 14:00 +0100
    Re: [PATCH] drm: modes: Revert cc344980c767 "replace simple_strtoul  by kstrtouint" Daniel Vetter <daniel@ffwll.ch> - 2015-12-11 17:20 +0100

#1289542 — [PATCH] drm: modes: Revert cc344980c767 "replace simple_strtoul by kstrtouint"

FromLABBE Corentin <clabbe.montjoie@gmail.com>
Date2015-12-11 14:00 +0100
Subject[PATCH] drm: modes: Revert cc344980c767 "replace simple_strtoul by kstrtouint"
Message-ID<qEvsL-4sJ-29@gated-at.bofh.it>
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.

Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
---
 drivers/gpu/drm/drm_modes.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
index db36af7..3da1434 100644
--- a/drivers/gpu/drm/drm_modes.c
+++ b/drivers/gpu/drm/drm_modes.c
@@ -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;
-}
+}
\ No newline at end of file
-- 
2.4.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1289711 — Re: [PATCH] drm: modes: Revert cc344980c767 "replace simple_strtoul by kstrtouint"

FromDaniel Vetter <daniel@ffwll.ch>
Date2015-12-11 17:20 +0100
SubjectRe: [PATCH] drm: modes: Revert cc344980c767 "replace simple_strtoul by kstrtouint"
Message-ID<qEyAi-6Pb-21@gated-at.bofh.it>
In reply to#1289542
On Fri, Dec 11, 2015 at 01:58:59PM +0100, LABBE Corentin wrote:
> 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.
> 
> Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>

Queued for -next, thanks for the patch.
-Daniel

> ---
>  drivers/gpu/drm/drm_modes.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index db36af7..3da1434 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -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;
> -}
> +}
> \ No newline at end of file
> -- 
> 2.4.10
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web