Skip to content

Commit

Permalink
arm64: Replace strncmp with str_has_prefix
Browse files Browse the repository at this point in the history
In commit b6b2735
("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>
  • Loading branch information
Chuhong Yuan authored and Will Deacon committed Aug 5, 2019
1 parent 3e77eeb commit b3e089c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arch/arm64/kernel/module-plts.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/mm/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b3e089c

Please sign in to comment.