* [PATCH] fbcon: Fix option parsing control flow in fb_console_setup
@ 2014-10-09 9:48 Maarten ter Huurne
2014-10-22 6:53 ` Tomi Valkeinen
0 siblings, 1 reply; 2+ messages in thread
From: Maarten ter Huurne @ 2014-10-09 9:48 UTC (permalink / raw)
To: Tomi Valkeinen, Jean-Christophe Plagniol-Villard
Cc: linux-fbdev, linux-kernel, Paul Cercueil, Maarten ter Huurne
Since strsep is used to tokenize the options string, after each option
match the code should use "continue" to get the next token from strsep.
This patch applies this pattern consistently.
Previously, for "scrollback:" and "map:" the parse code would return
(unconditionally: strsep ensures *options != ','), causing any
following option to be ignored, while for "vc:" the parse code would
go on to parse further options within the same token, which could lead
to invalid input being accepted.
Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
Acked-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/video/console/fbcon.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 57b1d44..eb976ee 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -448,8 +448,10 @@ static int __init fb_console_setup(char *this_opt)
return 1;
while ((options = strsep(&this_opt, ",")) != NULL) {
- if (!strncmp(options, "font:", 5))
+ if (!strncmp(options, "font:", 5)) {
strlcpy(fontname, options + 5, sizeof(fontname));
+ continue;
+ }
if (!strncmp(options, "scrollback:", 11)) {
options += 11;
@@ -457,13 +459,9 @@ static int __init fb_console_setup(char *this_opt)
fbcon_softback_size = simple_strtoul(options, &options, 0);
if (*options = 'k' || *options = 'K') {
fbcon_softback_size *= 1024;
- options++;
}
- if (*options != ',')
- return 1;
- options++;
- } else
- return 1;
+ }
+ continue;
}
if (!strncmp(options, "map:", 4)) {
@@ -478,8 +476,7 @@ static int __init fb_console_setup(char *this_opt)
fbcon_map_override();
}
-
- return 1;
+ continue;
}
if (!strncmp(options, "vc:", 3)) {
@@ -491,7 +488,8 @@ static int __init fb_console_setup(char *this_opt)
if (*options++ = '-')
last_fb_vc = simple_strtoul(options, &options, 10) - 1;
fbcon_is_default = 0;
- }
+ continue;
+ }
if (!strncmp(options, "rotate:", 7)) {
options += 7;
@@ -499,6 +497,7 @@ static int __init fb_console_setup(char *this_opt)
initial_rotation = simple_strtoul(options, &options, 0);
if (initial_rotation > 3)
initial_rotation = 0;
+ continue;
}
}
return 1;
--
1.8.4.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fbcon: Fix option parsing control flow in fb_console_setup
2014-10-09 9:48 [PATCH] fbcon: Fix option parsing control flow in fb_console_setup Maarten ter Huurne
@ 2014-10-22 6:53 ` Tomi Valkeinen
0 siblings, 0 replies; 2+ messages in thread
From: Tomi Valkeinen @ 2014-10-22 6:53 UTC (permalink / raw)
To: Maarten ter Huurne
Cc: Jean-Christophe Plagniol-Villard, linux-fbdev, linux-kernel,
Paul Cercueil
[-- Attachment #1: Type: text/plain, Size: 850 bytes --]
On 09/10/14 12:48, Maarten ter Huurne wrote:
> Since strsep is used to tokenize the options string, after each option
> match the code should use "continue" to get the next token from strsep.
> This patch applies this pattern consistently.
>
> Previously, for "scrollback:" and "map:" the parse code would return
> (unconditionally: strsep ensures *options != ','), causing any
> following option to be ignored, while for "vc:" the parse code would
> go on to parse further options within the same token, which could lead
> to invalid input being accepted.
>
> Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
> Acked-by: Paul Cercueil <paul@crapouillou.net>
> ---
> drivers/video/console/fbcon.c | 19 +++++++++----------
> 1 file changed, 9 insertions(+), 10 deletions(-)
Thanks, queued for 3.18 fixes.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-22 6:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-09 9:48 [PATCH] fbcon: Fix option parsing control flow in fb_console_setup Maarten ter Huurne
2014-10-22 6:53 ` Tomi Valkeinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).