diff mbox series

[v2,06/16] scripts/kallsyms: remove unneeded length check for prefix matching

Message ID 20191123160444.11251-7-yamada.masahiro@socionext.com
State Accepted
Commit c5e5002f3603e01f50d8d61878a4ca8ffca7bd15
Headers show
Series scripts/kallsyms: various cleanups and optimizations | expand

Commit Message

Masahiro Yamada Nov. 23, 2019, 4:04 p.m. UTC
l <= strlen(sym_name) is unnecessary for prefix matching.
strncmp() will do.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

---

Changes in v2: None

 scripts/kallsyms.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 14a50c8d3f34..a57636c6f84f 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -246,8 +246,7 @@  static int symbol_valid(struct sym_entry *s)
 	for (i = 0; special_prefixes[i]; i++) {
 		int l = strlen(special_prefixes[i]);
 
-		if (l <= strlen(sym_name) &&
-		    strncmp(sym_name, special_prefixes[i], l) == 0)
+		if (strncmp(sym_name, special_prefixes[i], l) == 0)
 			return 0;
 	}