diff options
Diffstat (limited to 'scripts/mod/modpost.c')
-rw-r--r-- | scripts/mod/modpost.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 588a3bc29ecc..01b466894cb7 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -383,9 +383,10 @@ failed: * spaces in the beginning of the line is trimmed away. * Return a pointer to a static buffer. **/ +#define MODPOST_MAX_LINE 32768 char *get_next_line(unsigned long *pos, void *file, unsigned long size) { - static char line[4096]; + static char line[MODPOST_MAX_LINE]; int skip = 1; size_t len = 0; signed char *p = (signed char *)file + *pos; @@ -400,8 +401,11 @@ char *get_next_line(unsigned long *pos, void *file, unsigned long size) if (*p != '\n' && (*pos < size)) { len++; *s++ = *p++; - if (len > 4095) + if (len > (sizeof(line)-1)) { + warn(" %s: line exceeds buffer size %zu bytes\n" + , __func__, sizeof(line)); break; /* Too long, stop */ + } } else { /* End of string */ *s = '\0'; @@ -1949,7 +1953,7 @@ static void read_symbols(const char *modname) char *version; char *license; struct module *mod; - struct elf_info info = { }; + struct elf_info info = { .hdr = NULL }; Elf_Sym *sym; if (!parse_elf(&info, modname)) @@ -2398,7 +2402,7 @@ static int dump_sym(struct symbol *sym) static void write_dump(const char *fname) { - struct buffer buf = { }; + struct buffer buf = { NULL, 0, 0 }; struct symbol *symbol; int n; @@ -2425,7 +2429,7 @@ struct ext_sym_list { int main(int argc, char **argv) { struct module *mod; - struct buffer buf = { }; + struct buffer buf = { NULL, 0, 0 }; char *kernel_read = NULL, *module_read = NULL; char *dump_write = NULL, *files_source = NULL; int opt; |