[PATCH] arm64: idreg-override: Detect trailing "--" in __parse_cmdline()

Catalin Marinas catalin.marinas at arm.com
Tue Oct 27 05:14:07 PDT 2026


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 at 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



More information about the linux-arm-kernel mailing list