All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@kernel.org>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	lkml <linux-kernel@vger.kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: [PATCHv3 bpf-next 02/13] kallsyms: Skip the name search for empty string
Date: Wed, 16 Mar 2022 13:24:08 +0100	[thread overview]
Message-ID: <20220316122419.933957-3-jolsa@kernel.org> (raw)
In-Reply-To: <20220316122419.933957-1-jolsa@kernel.org>

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>
---
 kernel/kallsyms.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 951c93216fc4..79f2eb617a62 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));
 
-- 
2.35.1


  parent reply	other threads:[~2022-03-16 12:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 12:24 [PATCHv3 bpf-next 00/13] bpf: Add kprobe multi link Jiri Olsa
2022-03-16 12:24 ` [PATCHv3 bpf-next 01/13] lib/sort: Add priv pointer to swap function Jiri Olsa
2022-03-16 12:24 ` Jiri Olsa [this message]
2022-03-16 12:24 ` [PATCHv3 bpf-next 03/13] bpf: Add multi kprobe link Jiri Olsa
2022-03-16 18:53   ` Alexei Starovoitov
2022-03-17 13:24     ` Jiri Olsa
2022-03-16 12:24 ` [PATCHv3 bpf-next 04/13] bpf: Add bpf_get_func_ip kprobe helper for " Jiri Olsa
2022-03-16 12:24 ` [PATCHv3 bpf-next 05/13] bpf: Add support to inline bpf_get_func_ip helper on x86 Jiri Olsa
2022-03-16 12:24 ` [PATCHv3 bpf-next 06/13] bpf: Add cookie support to programs attached with kprobe multi link Jiri Olsa
2022-03-16 12:24 ` [PATCHv3 bpf-next 07/13] libbpf: Add libbpf_kallsyms_parse function Jiri Olsa
2022-03-16 12:24 ` [PATCHv3 bpf-next 08/13] libbpf: Add bpf_link_create support for multi kprobes Jiri Olsa
2022-03-16 12:24 ` [PATCHv3 bpf-next 09/13] libbpf: Add bpf_program__attach_kprobe_multi_opts function Jiri Olsa
2022-03-18  3:53   ` Alexei Starovoitov
2022-03-18  5:14     ` Andrii Nakryiko
2022-03-18  9:22       ` Jiri Olsa
2022-03-18  9:08     ` Jiri Olsa
2022-03-16 12:24 ` [PATCHv3 bpf-next 10/13] selftests/bpf: Add kprobe_multi attach test Jiri Olsa
2022-03-16 12:24 ` [PATCHv3 bpf-next 11/13] selftests/bpf: Add kprobe_multi bpf_cookie test Jiri Olsa
2022-03-16 12:24 ` [PATCHv3 bpf-next 12/13] selftests/bpf: Add attach test for bpf_program__attach_kprobe_multi_opts Jiri Olsa
2022-03-16 12:24 ` [PATCHv3 bpf-next 13/13] selftests/bpf: Add cookie " Jiri Olsa
2022-03-18  3:50 ` [PATCHv3 bpf-next 00/13] bpf: Add kprobe multi link patchwork-bot+netdevbpf
2022-03-19  5:50 ` Andrii Nakryiko
2022-03-19 12:27   ` Jiri Olsa
2022-03-19 14:31     ` Jiri Olsa
2022-03-19 18:26       ` Andrii Nakryiko
2022-03-19 19:01         ` Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220316122419.933957-3-jolsa@kernel.org \
    --to=jolsa@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.