Re: [PATCH] arm64/mm: Reject invalid NUMA option

Gavin Shan
2020-04-28T04:35:45Z

Hi Steven and Mark,

On 4/28/20 1:09 PM, Steven Rostedt wrote:

[...]

>
> Could this be a bug in the implementation of strncmp() in
> arch/arm64/lib/strncmp.S. As I don't know arm64 assembly, I have no idea
> what it is trying to do.
>
> But strncmp("o","off",3) returning zero *is* a bug.
>

I think it's false alarm. The patch has been in my local repo for a while.
I checked out 5.7.rc3 and tried passing "numa=o" to the kernel, @numa_off
is unchanged and its value is false. I also check the return value from
strncmp() as below, it's correct. Nothing is broken. I should have retested
before posting it. Sorry for the noise. Please ignore the crap patch :)

diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
index 4decf1659700..a8e5c6f7ba25 100644
--- a/arch/arm64/mm/numa.c
+++ b/arch/arm64/mm/numa.c
@@ -32,6 +32,13 @@ static __init int numa_parse_early_param(char *opt)
if (str_has_prefix(opt, "off"))
numa_off = true;

+ pr_info("numa_off=%s\n", numa_off ? "true" : "false");
+ pr_info("opt=%s\n", opt);
+ pr_info("len=%d\n", (int)strlen("off"));
+ pr_info("\n");
+ pr_info("================================\n");
+ pr_info("strncmp(opt, 'off', 3)=%d\n", strncmp(opt, "off", 3));
+

[ 0.000000] NUMA: numa_off=false
[ 0.000000] NUMA: opt=o
[ 0.000000] NUMA: len=3
[ 0.000000] NUMA:
[ 0.000000] NUMA: ================================
[ 0.000000] NUMA: strncmp(opt, 'off', 3)=-102

Thanks,
Gavin