* [PATCH] arm64: idreg-override: Detect trailing "--" in __parse_cmdline()
@ 2026-10-15 16:10 Thorsten Blum
2026-10-27 12:14 ` Catalin Marinas
0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2026-10-15 16:10 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, Mark Rutland, Robin Murphy,
Oliver Upton, Yureka Lilian, Marc Zyngier, Ard Biesheuvel
Cc: Thorsten Blum, linux-arm-kernel, linux-kernel
__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 <blum@kernel.org>
---
arch/arm64/kernel/pi/idreg-override.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kernel/pi/idreg-override.c b/arch/arm64/kernel/pi/idreg-override.c
index acaf56234973..38aa28d19650 100644
--- a/arch/arm64/kernel/pi/idreg-override.c
+++ b/arch/arm64/kernel/pi/idreg-override.c
@@ -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++) {
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] arm64: idreg-override: Detect trailing "--" in __parse_cmdline()
2026-10-15 16:10 [PATCH] arm64: idreg-override: Detect trailing "--" in __parse_cmdline() Thorsten Blum
@ 2026-10-27 12:14 ` Catalin Marinas
2026-10-27 14:49 ` Thorsten Blum
0 siblings, 1 reply; 4+ messages in thread
From: Catalin Marinas @ 2026-10-27 12:14 UTC (permalink / raw)
To: Thorsten Blum
Cc: Will Deacon, Mark Rutland, Robin Murphy, Oliver Upton,
Yureka Lilian, Marc Zyngier, Ard Biesheuvel, linux-arm-kernel,
linux-kernel
On Thu, Oct 15, 2026 at 06:10:54PM +0200, Thorsten Blum wrote:
> __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 <blum@kernel.org>
> ---
> arch/arm64/kernel/pi/idreg-override.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/kernel/pi/idreg-override.c b/arch/arm64/kernel/pi/idreg-override.c
> index acaf56234973..38aa28d19650 100644
> --- a/arch/arm64/kernel/pi/idreg-override.c
> +++ b/arch/arm64/kernel/pi/idreg-override.c
> @@ -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.
--
Catalin
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] arm64: idreg-override: Detect trailing "--" in __parse_cmdline()
2026-10-27 12:14 ` Catalin Marinas
@ 2026-10-27 14:49 ` Thorsten Blum
2026-10-27 16:45 ` Catalin Marinas
0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2026-10-27 14:49 UTC (permalink / raw)
To: Catalin Marinas
Cc: Will Deacon, Mark Rutland, Robin Murphy, Oliver Upton,
Yureka Lilian, Marc Zyngier, Ard Biesheuvel, linux-arm-kernel,
linux-kernel
Hi Catalin,
On Tue, Oct 27, 2026 at 12:14:07PM +0000, Catalin Marinas wrote:
> On Thu, Oct 15, 2026 at 06:10:54PM +0200, Thorsten Blum wrote:
> > __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 <blum@kernel.org>
> > ---
> > arch/arm64/kernel/pi/idreg-override.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm64/kernel/pi/idreg-override.c b/arch/arm64/kernel/pi/idreg-override.c
> > index acaf56234973..38aa28d19650 100644
> > --- a/arch/arm64/kernel/pi/idreg-override.c
> > +++ b/arch/arm64/kernel/pi/idreg-override.c
> > @@ -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.
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
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] arm64: idreg-override: Detect trailing "--" in __parse_cmdline()
2026-10-27 14:49 ` Thorsten Blum
@ 2026-10-27 16:45 ` Catalin Marinas
0 siblings, 0 replies; 4+ messages in thread
From: Catalin Marinas @ 2026-10-27 16:45 UTC (permalink / raw)
To: Thorsten Blum
Cc: Will Deacon, Mark Rutland, Robin Murphy, Oliver Upton,
Yureka Lilian, Marc Zyngier, Ard Biesheuvel, linux-arm-kernel,
linux-kernel
On Tue, Oct 27, 2026 at 03:49:45PM +0100, Thorsten Blum wrote:
> On Tue, Oct 27, 2026 at 12:14:07PM +0000, Catalin Marinas wrote:
> > On Thu, Oct 15, 2026 at 06:10:54PM +0200, Thorsten Blum wrote:
> > > __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 <blum@kernel.org>
> > > ---
> > > arch/arm64/kernel/pi/idreg-override.c | 5 +++--
> > > 1 file changed, 3 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/arch/arm64/kernel/pi/idreg-override.c b/arch/arm64/kernel/pi/idreg-override.c
> > > index acaf56234973..38aa28d19650 100644
> > > --- a/arch/arm64/kernel/pi/idreg-override.c
> > > +++ b/arch/arm64/kernel/pi/idreg-override.c
> > > @@ -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.
>
> 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.
Makes sense. We might make it a comment when applying rather than a
dedicated Fixes tag.
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-27 16:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-15 16:10 [PATCH] arm64: idreg-override: Detect trailing "--" in __parse_cmdline() Thorsten Blum
2026-10-27 12:14 ` Catalin Marinas
2026-10-27 14:49 ` Thorsten Blum
2026-10-27 16:45 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®