From c7d47f26df949f0031fe2905068ee85db1b63ed9 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 2 Aug 2016 21:43:01 +0200 Subject: modpost: free allocated memory valgrind complains that memory is not freed after allocation with realloc() called from main() and write_dump(). So let us free the allocated memory properly. Signed-off-by: Heinrich Schuchardt Signed-off-by: Rusty Russell Link: http://lkml.kernel.org/r/1470166981-6461-1-git-send-email-xypron.glpk@gmx.de Signed-off-by: Jessica Yu --- scripts/mod/modpost.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts/mod') diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index bd8349759095..5a6b39a29b7a 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -2371,6 +2371,7 @@ static void write_dump(const char *fname) } } write_if_changed(&buf, fname); + free(buf.p); } struct ext_sym_list { @@ -2496,6 +2497,7 @@ int main(int argc, char **argv) "Set CONFIG_SECTION_MISMATCH_WARN_ONLY=y to allow them.\n"); } } + free(buf.p); return err; } -- cgit v1.3-7-g2ca7 From d8c1eb86e9528214fed7909bfef988b472a76c2c Mon Sep 17 00:00:00 2001 From: Nicholas Piggin Date: Thu, 24 Nov 2016 03:41:42 +1100 Subject: kbuild: modpost warn if export version crc is missing This catches the failing ceph CRC on with: LD vmlinux.o MODPOST vmlinux.o WARNING: EXPORT symbol "ceph_monc_do_statfs" [vmlinux] version generation failed, symbol will not be versioned. When the modules referring to exported symbols are built, there is an existing warning for missing CRC, but it's not always the case such any such module will be built, and in any case it is useful to get a warning at the source. This gets a little verbose with CONFIG_DEBUG_SECTION_MISMATCH, producing a warning with each object linked, but I didn't think that warranted extra complexity to avoid. Signed-off-by: Nicholas Piggin Signed-off-by: Michal Marek --- scripts/mod/modpost.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'scripts/mod') diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index bd8349759095..08f62a1af67d 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -609,6 +609,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, { unsigned int crc; enum export export; + bool is_crc = false; if ((!is_vmlinux(mod->name) || mod->is_dot_o) && strncmp(symname, "__ksymtab", 9) == 0) @@ -618,6 +619,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, /* CRC'd symbol */ if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { + is_crc = true; crc = (unsigned int) sym->st_value; sym_update_crc(symname + strlen(CRC_PFX), mod, crc, export); @@ -663,6 +665,10 @@ static void handle_modversions(struct module *mod, struct elf_info *info, else symname++; #endif + if (is_crc) { + const char *e = is_vmlinux(mod->name) ?"":".ko"; + warn("EXPORT symbol \"%s\" [%s%s] version generation failed, symbol will not be versioned.\n", symname + strlen(CRC_PFX), mod->name, e); + } mod->unres = alloc_symbol(symname, ELF_ST_BIND(sym->st_info) == STB_WEAK, mod->unres); -- cgit v1.3-7-g2ca7