projects
/
linux-2.6-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a0019cd
)
kallsyms: Skip the name search for empty string
author
Jiri Olsa
<jolsa@kernel.org>
Wed, 16 Mar 2022 12:24:08 +0000
(13:24 +0100)
committer
Alexei Starovoitov
<ast@kernel.org>
Fri, 18 Mar 2022 03:17:18 +0000
(20:17 -0700)
When kallsyms_lookup_name is called with empty string,
it will do futile search for it through all the symbols.
Skipping the search for empty string.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link:
https://lore.kernel.org/bpf/20220316122419.933957-3-jolsa@kernel.org
kernel/kallsyms.c
patch
|
blob
|
blame
|
history
diff --git
a/kernel/kallsyms.c
b/kernel/kallsyms.c
index 951c93216fc4d92cae0bf373c60581d9f0c68d57..79f2eb617a62aed4e8f62796be853cba55d2bb34 100644
(file)
--- a/
kernel/kallsyms.c
+++ b/
kernel/kallsyms.c
@@
-212,6
+212,10
@@
unsigned long kallsyms_lookup_name(const char *name)
unsigned long i;
unsigned int off;
+ /* Skip the search for empty string. */
+ if (!*name)
+ return 0;
+
for (i = 0, off = 0; i < kallsyms_num_syms; i++) {
off = kallsyms_expand_symbol(off, namebuf, ARRAY_SIZE(namebuf));