/* A list of all modules we processed */
 LIST_HEAD(modules);
 
-static struct module *find_module(const char *modname)
+static struct module *find_module(const char *filename, const char *modname)
 {
        struct module *mod;
 
        list_for_each_entry(mod, &modules, list) {
-               if (strcmp(mod->name, modname) == 0)
+               if (!strcmp(mod->dump_file, filename) &&
+                   !strcmp(mod->name, modname))
                        return mod;
        }
        return NULL;
                        continue;
                }
 
-               mod = find_module(modname);
+               mod = find_module(fname, modname);
                if (!mod) {
                        mod = new_module(modname, strlen(modname));
-                       mod->from_dump = true;
+                       mod->dump_file = fname;
                }
                s = sym_add_exported(symname, mod, gpl_only, namespace);
                sym_set_crc(s, crc);
        struct symbol *sym;
 
        list_for_each_entry(mod, &modules, list) {
-               if (mod->from_dump)
+               if (mod->dump_file)
                        continue;
                list_for_each_entry(sym, &mod->exported_symbols, list) {
                        if (trim_unused_exports && !sym->used)
 
        list_for_each_entry(mod, &modules, list) {
 
-               if (mod->from_dump || list_empty(&mod->missing_namespaces))
+               if (mod->dump_file || list_empty(&mod->missing_namespaces))
                        continue;
 
                buf_printf(&ns_deps_buf, "%s.ko:", mod->name);
                read_symbols_from_files(files_source);
 
        list_for_each_entry(mod, &modules, list) {
-               if (mod->from_dump || mod->is_vmlinux)
+               if (mod->dump_file || mod->is_vmlinux)
                        continue;
 
                check_modname_len(mod);
                handle_white_list_exports(unused_exports_white_list);
 
        list_for_each_entry(mod, &modules, list) {
-               if (mod->from_dump)
+               if (mod->dump_file)
                        continue;
 
                if (mod->is_vmlinux)
 
 /**
  * struct module - represent a module (vmlinux or *.ko)
  *
+ * @dump_file: path to the .symvers file if loaded from a file
  * @aliases: list head for module_aliases
  */
 struct module {
        struct list_head list;
        struct list_head exported_symbols;
        struct list_head unresolved_symbols;
+       const char *dump_file;
        bool is_gpl_compatible;
-       bool from_dump;         /* true if module was loaded from *.symvers */
        bool is_vmlinux;
        bool seen;
        bool has_init;