]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - scripts/mod/modpost.c
kbuild: declare the modpost error functions as printf like
[linux-2.6-omap-h63xx.git] / scripts / mod / modpost.c
index 0a4051fbd34e24116cd55c4e758605ea683348a8..3a12c22cc2f8f0ca82f624a50c4878fce389e7bb 100644 (file)
@@ -33,7 +33,9 @@ enum export {
        export_unused_gpl, export_gpl_future, export_unknown
 };
 
-void fatal(const char *fmt, ...)
+#define PRINTF __attribute__ ((format (printf, 1, 2)))
+
+PRINTF void fatal(const char *fmt, ...)
 {
        va_list arglist;
 
@@ -46,7 +48,7 @@ void fatal(const char *fmt, ...)
        exit(1);
 }
 
-void warn(const char *fmt, ...)
+PRINTF void warn(const char *fmt, ...)
 {
        va_list arglist;
 
@@ -57,7 +59,7 @@ void warn(const char *fmt, ...)
        va_end(arglist);
 }
 
-void merror(const char *fmt, ...)
+PRINTF void merror(const char *fmt, ...)
 {
        va_list arglist;
 
@@ -268,6 +270,9 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod,
                             "was in %s%s\n", mod->name, name,
                             s->module->name,
                             is_vmlinux(s->module->name) ?"":".ko");
+               } else {
+                       /* In case Modules.symvers was out of date */
+                       s->module = mod;
                }
        }
        s->preloaded = 0;
@@ -381,6 +386,12 @@ static int parse_elf(struct elf_info *info, const char *filename)
        sechdrs = (void *)hdr + hdr->e_shoff;
        info->sechdrs = sechdrs;
 
+       /* Check if file offset is correct */
+       if (hdr->e_shoff > info->size) {
+               fatal("section header offset=%u in file '%s' is bigger then filesize=%lu\n", hdr->e_shoff, filename, info->size);
+               return 0;
+       }
+
        /* Fix endianness in section headers */
        for (i = 0; i < hdr->e_shnum; i++) {
                sechdrs[i].sh_type   = TO_NATIVE(sechdrs[i].sh_type);