linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: Replace strncmp with str_has_prefix
@ 2019-07-30  2:44 Chuhong Yuan
  2019-07-30  9:37 ` Will Deacon
  0 siblings, 1 reply; 2+ messages in thread
From: Chuhong Yuan @ 2019-07-30  2:44 UTC (permalink / raw)
  Cc: Catalin Marinas, Will Deacon, linux-arm-kernel, linux-kernel,
	Chuhong Yuan

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>
---
 arch/arm64/kernel/module-plts.c | 2 +-
 arch/arm64/mm/numa.c            | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/module-plts.c b/arch/arm64/kernel/module-plts.c
index 044c0ae4d6c8..b182442b87a3 100644
--- a/arch/arm64/kernel/module-plts.c
+++ b/arch/arm64/kernel/module-plts.c
@@ -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
diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
index 4f241cc7cc3b..4decf1659700 100644
--- a/arch/arm64/mm/numa.c
+++ b/arch/arm64/mm/numa.c
@@ -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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] arm64: Replace strncmp with str_has_prefix
  2019-07-30  2:44 [PATCH] arm64: Replace strncmp with str_has_prefix Chuhong Yuan
@ 2019-07-30  9:37 ` Will Deacon
  0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2019-07-30  9:37 UTC (permalink / raw)
  To: Chuhong Yuan; +Cc: Catalin Marinas, linux-arm-kernel, linux-kernel

On Tue, Jul 30, 2019 at 10:44:15AM +0800, Chuhong Yuan wrote:
> 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>
> ---
>  arch/arm64/kernel/module-plts.c | 2 +-
>  arch/arm64/mm/numa.c            | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

I can pick this up for 5.4.

Will

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-30  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30  2:44 [PATCH] arm64: Replace strncmp with str_has_prefix Chuhong Yuan
2019-07-30  9:37 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).