arm64: idreg-override: Detect trailing "--" in __parse_cmdline()
PATCH 1/1 arm64: idreg-override: Detect trailing "--" in __parse_cmdline()
__parse_cmdline() detects "--" only if it is followed by whitespace. However, at the end of the command line, it converts the dashes to underscores and tries to match "__" as an option.
Detect trailing "--" directly instead of converting it to "__".
--- arch/arm64/kernel/pi/idreg-override.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm64/kernel/pi/idreg-override.c +3 -2
@@ -352,8 +352,9 @@ static __init void __parse_cmdline(const char *cmdline, bool parse_aliases) cmdline =skip_spaces (cmdline); -/* terminate on "--" appearing on the command line by itself */ -if (cmdline[0 ] =='-' && cmdline[1 ] =='-' &&isspace (cmdline[2 ])) +/* Stop at "--" appearing as a separate argument. */ +if (cmdline[0 ] =='-' && cmdline[1 ] =='-' && + (!cmdline[2 ] ||isspace (cmdline[2 ])))return ;for (len =0 ; cmdline[len] && !isspace (cmdline[len]); len++) {
Catalin Marinas
maintainerQuoted 17 lines · Thorsten Blum
__parse_cmdline()detects "--" only if it is followed by whitespace. However, at the end of the command line, it converts the dashes to underscores and tries to match "__" as an option.Detect trailing "--" directly instead of converting it to "__".
Fixes dc3f5aae0638 ("arm64: idreg-override: Avoid parameq() and parameqn()")Signed-off-by Thorsten Blum <[email protected]>--- arch/arm64/kernel/pi/idreg-override.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)arch/arm64/kernel/pi/idreg-override.c +0
-0
arch/arm64/kernel/pi/idreg-override.c static __init void __parse_cmdline(const char *cmdline, bool parse_aliases) · line 358
Quoted 9 lines
arch/arm64/kernel/pi/idreg-override.c +3
-2@@ -352,8 +352,9 @@ static __init void __parse_cmdline(const char *cmdline, bool parse_aliases) cmdline =skip_spaces (cmdline); -/* terminate on "--" appearing on the command line by itself */ -if (cmdline[0 ] =='-' && cmdline[1 ] =='-' &&isspace (cmdline[2 ])) +/* Stop at "--" appearing as a separate argument. */ +if (cmdline[0 ] =='-' && cmdline[1 ] =='-' && + (!cmdline[2 ] ||isspace (cmdline[2 ])))return ;
I guess that's more of a cleanup. Does it actually fix anything to deserve a Fixes tag? We skip an unnecessary lookup for "__" but there's no functional difference.
Signature · 1 line
Catalin
Hi Catalin,
Quoted 21 lines · Catalin Marinas
Quoted 20 lines · Thorsten Blum
__parse_cmdline()detects "--" only if it is followed by whitespace. However, at the end of the command line, it converts the dashes to underscores and tries to match "__" as an option.Detect trailing "--" directly instead of converting it to "__".
Fixes dc3f5aae0638 ("arm64: idreg-override: Avoid parameq() and parameqn()")Signed-off-by Thorsten Blum <[email protected]>--- arch/arm64/kernel/pi/idreg-override.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)arch/arm64/kernel/pi/idreg-override.c +0
-0@@ -352,8 +352,9 @@ static __init void __parse_cmdline(const char *cmdline, bool parse_aliases) cmdline =skip_spaces (cmdline);
Quoted 10 lines
arch/arm64/kernel/pi/idreg-override.c static __init void __parse_cmdline(const char *cmdline, bool parse_aliases) · line 358
Quoted 6 lines
arch/arm64/kernel/pi/idreg-override.c +3
-2-/* terminate on "--" appearing on the command line by itself */ -if (cmdline[0 ] =='-' && cmdline[1 ] =='-' &&isspace (cmdline[2 ])) +/* Stop at "--" appearing as a separate argument. */ +if (cmdline[0 ] =='-' && cmdline[1 ] =='-' && + (!cmdline[2 ] ||isspace (cmdline[2 ])))return ;I guess that's more of a cleanup. Does it actually fix anything to deserve a Fixes tag? We skip an unnecessary lookup for "__" but there's no functional difference.
Yes, it's a cleanup.
Functionally, the behavior is equivalent because it also happened to work before. However, commit dc3f5aae0638 removed the explicit detection of a trailing "--", so I added the Fixes tag mostly for provenance.
Thanks,
Thorsten
Quoted 33 lines · Thorsten Blum
Quoted 21 lines · Catalin Marinas
Quoted 20 lines · Thorsten Blum
__parse_cmdline()detects "--" only if it is followed by whitespace. However, at the end of the command line, it converts the dashes to underscores and tries to match "__" as an option.Detect trailing "--" directly instead of converting it to "__".
Fixes dc3f5aae0638 ("arm64: idreg-override: Avoid parameq() and parameqn()")Signed-off-by Thorsten Blum <[email protected]>--- arch/arm64/kernel/pi/idreg-override.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)arch/arm64/kernel/pi/idreg-override.c +0
-0@@ -352,8 +352,9 @@ static __init void __parse_cmdline(const char *cmdline, bool parse_aliases) cmdline =skip_spaces (cmdline);Quoted 10 lines
arch/arm64/kernel/pi/idreg-override.c static __init void __parse_cmdline(const char *cmdline, bool parse_aliases) · line 358
Quoted 6 lines
arch/arm64/kernel/pi/idreg-override.c +3
-2-/* terminate on "--" appearing on the command line by itself */ -if (cmdline[0 ] =='-' && cmdline[1 ] =='-' &&isspace (cmdline[2 ])) +/* Stop at "--" appearing as a separate argument. */ +if (cmdline[0 ] =='-' && cmdline[1 ] =='-' && + (!cmdline[2 ] ||isspace (cmdline[2 ])))return ;I guess that's more of a cleanup. Does it actually fix anything to deserve a Fixes tag? We skip an unnecessary lookup for "__" but there's no functional difference.
Quoted 5 lines
Yes, it's a cleanup.
Functionally, the behavior is equivalent because it also happened to work before. However, commit
dc3f5aae0638removed the explicit detection of a trailing "--", so I added the Fixes tag mostly for provenance.
Makes sense. We might make it a comment when applying rather than a dedicated Fixes tag.