lkml.org 
[lkml]   [2022]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCHv3 bpf-next 02/13] kallsyms: Skip the name search for empty string
    Date
    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
    \
     
     \ /
      Last update: 2022-03-16 13:26    [W:5.018 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site