arm64: Replace strncmp with str_has_prefix
authorChuhong Yuan <hslester96@gmail.com>
Tue, 30 Jul 2019 02:44:15 +0000 (10:44 +0800)
committerWill Deacon <will@kernel.org>
Mon, 5 Aug 2019 10:06:34 +0000 (11:06 +0100)
In commit b6b2735514bc
("tracing: Use str_has_prefix() instead of using fixed sizes")
the newly introduced str_has_prefix() was used
to replace error-prone strncmp(str, const, len).
Here fix codes with the same pattern.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/module-plts.c
arch/arm64/mm/numa.c

index 044c0ae4d6c85eac6db5000facc151b805e4b05e..b182442b87a32fcf4836f2179466c50508a6372d 100644 (file)
@@ -302,7 +302,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
                /* sort by type, symbol index and addend */
                sort(rels, numrels, sizeof(Elf64_Rela), cmp_rela, NULL);
 
-               if (strncmp(secstrings + dstsec->sh_name, ".init", 5) != 0)
+               if (!str_has_prefix(secstrings + dstsec->sh_name, ".init"))
                        core_plts += count_plts(syms, rels, numrels,
                                                sechdrs[i].sh_info, dstsec);
                else
index 4f241cc7cc3b1262dfe0d083e3dc48468bd62c11..4decf16597008925206085b9e8efacc9ba537a71 100644 (file)
@@ -29,7 +29,7 @@ static __init int numa_parse_early_param(char *opt)
 {
        if (!opt)
                return -EINVAL;
-       if (!strncmp(opt, "off", 3))
+       if (str_has_prefix(opt, "off"))
                numa_off = true;
 
        return 0;