kallsyms: Handle too long symbols in kallsyms.c [Linux 5.0]

kallsyms: Handle too long symbols in kallsyms.c [Linux 5.0]

This Linux kernel change "kallsyms: Handle too long symbols in kallsyms.c" is included in the Linux 5.0 release. This change is authored by Eugene Loh <eugene.loh [at] oracle.com> on Thu Jan 17 14:46:00 2019 -0800. The commit for this change in Linux stable tree is 6db2983 (patch).

kallsyms: Handle too long symbols in kallsyms.c

When checking for symbols with excessively long names,
account for null terminating character.

Fixes: f3462aa952cf ("Kbuild: Handle longer symbols in kallsyms.c")
Signed-off-by: Eugene Loh <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

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

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index 77cebad..f75e7bd 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -118,8 +118,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)
            fprintf(stderr, "Read error or end of file.\n");
        return -1;
    }
-   if (strlen(sym) > KSYM_NAME_LEN) {
-       fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n"
+   if (strlen(sym) >= KSYM_NAME_LEN) {
+       fprintf(stderr, "Symbol %s too long for kallsyms (%zu >= %d).\n"
                "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n",
            sym, strlen(sym), KSYM_NAME_LEN);
        return -1;

Leave a Reply

Your email address will not be published. Required fields are marked *