Skip to content

[RFC] Fix the support of larger symbol name #503

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions scripts/kallsyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))

#define _stringify_1(x) #x
#define _stringify(x) _stringify_1(x)

#define KSYM_NAME_LEN 512

struct sym_entry {
Expand Down Expand Up @@ -197,15 +200,15 @@ static void check_symbol_range(const char *sym, unsigned long long addr,

static struct sym_entry *read_symbol(FILE *in)
{
char name[500], type;
char name[KSYM_NAME_LEN+1], type;
unsigned long long addr;
unsigned int len;
struct sym_entry *sym;
int rc;

rc = fscanf(in, "%llx %c %499s\n", &addr, &type, name);
rc = fscanf(in, "%llx %c %" _stringify(KSYM_NAME_LEN) "s\n", &addr, &type, name);
if (rc != 3) {
if (rc != EOF && fgets(name, 500, in) == NULL)
if (rc != EOF && fgets(name, KSYM_NAME_LEN + 1, in) == NULL)
fprintf(stderr, "Read error or end of file.\n");
return NULL;
}
Expand Down