objtool/klp: Fix line numbers in Module.symvers parse errors

read_exports() reports the offending line number when it fails to parse
Module.symvers.  The counter is initialized to 1 but never incremented,
so every error blames line 1 regardless of where the bad line is.

Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
Acked-by: Song Liu <song@kernel.org>
Link: https://patch.msgid.link/133e16bb0c7cb916f10bbfb017eba525449ad1d6.1786138493.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
This commit is contained in:
Josh Poimboeuf 2026-08-07 14:37:54 -07:00
parent 4cd3cfb8b5
commit 51c1de1348

View File

@ -118,7 +118,7 @@ static int read_exports(void)
{
const char *symvers = "Module.symvers";
char line[1024], *path = NULL;
unsigned int line_num = 1;
unsigned int line_num = 0;
FILE *file;
file = fopen(symvers, "r");
@ -140,6 +140,8 @@ static int read_exports(void)
char *sym, *mod, *type, *namespace;
struct export *export;
line_num++;
sym = strchr(line, '\t');
if (!sym) {
ERROR("malformed Module.symvers (sym) at line %d", line_num);