From: Jiri Olsa Date: Wed, 16 Mar 2022 12:24:08 +0000 (+0100) Subject: kallsyms: Skip the name search for empty string X-Git-Tag: v6.1-rc5~1746^2~11^2~28^2~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aecf489f2ce51436402818c96639ed6303b540f8;p=platform%2Fkernel%2Flinux-starfive.git kallsyms: Skip the name search for empty string 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 Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20220316122419.933957-3-jolsa@kernel.org --- diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 951c932..79f2eb6 100644 --- 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));