[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200424101132.GC1167@C02TD0UTHF1T.local>
Date: Fri, 24 Apr 2020 11:11:32 +0100
From: Mark Rutland <mark.rutland@....com>
To: Gavin Shan <gshan@...hat.com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
catalin.marinas@....com, will@...nel.org, shan.gavin@...il.com,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH] arm64/mm: Reject invalid NUMA option
[Adding Steve, who added str_has_prefix()]
On Fri, Apr 24, 2020 at 02:53:14PM +1000, Gavin Shan wrote:
> The NUMA option is parsed by str_has_prefix() and the invalid option
> like "numa=o" can be regarded as "numa=off" wrongly.
Are you certain that can pass? If that can happen, str_has_prefix() is
misnamed and does not seem to do what its kerneldoc says it does, as
"off" is not a prefix of "o".
> This fixes the issue with sysfs_streq(), which have more sanity checks,
> to avoid accepting the invalid options.
That doesn't sound immediately right, since this is an early parameter,
which has nothing to do with sysfs. Perhaps that's just a misleading
name?
Thanks,
Mark.
> Signed-off-by: Gavin Shan <gshan@...hat.com>
> ---
> arch/arm64/mm/numa.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
> index 4decf1659700..bd458b28616a 100644
> --- a/arch/arm64/mm/numa.c
> +++ b/arch/arm64/mm/numa.c
> @@ -29,7 +29,8 @@ static __init int numa_parse_early_param(char *opt)
> {
> if (!opt)
> return -EINVAL;
> - if (str_has_prefix(opt, "off"))
> +
> + if (sysfs_streq(opt, "off"))
> numa_off = true;
>
> return 0;
> --
> 2.23.0
>
Powered by blists - more mailing lists