Commit bca2ccee authored by Masahiro Yamada's avatar Masahiro Yamada

modpost: pass struct elf_info pointer to get_modinfo()

get_(next_)modinfo takes a pointer and length pair of the .modinfo
section.  Instead, pass struct elf_info pointer to reduce the number
of function arguments.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent a6b04f0e
...@@ -724,16 +724,17 @@ static char *next_string(char *string, unsigned long *secsize) ...@@ -724,16 +724,17 @@ static char *next_string(char *string, unsigned long *secsize)
return string; return string;
} }
static char *get_next_modinfo(void *modinfo, unsigned long modinfo_len, static char *get_next_modinfo(struct elf_info *info, const char *tag,
const char *tag, char *info) char *prev)
{ {
char *p; char *p;
unsigned int taglen = strlen(tag); unsigned int taglen = strlen(tag);
unsigned long size = modinfo_len; char *modinfo = info->modinfo;
unsigned long size = info->modinfo_len;
if (info) { if (prev) {
size -= info - (char *)modinfo; size -= prev - modinfo;
modinfo = next_string(info, &size); modinfo = next_string(prev, &size);
} }
for (p = modinfo; p; p = next_string(p, &size)) { for (p = modinfo; p; p = next_string(p, &size)) {
...@@ -743,11 +744,10 @@ static char *get_next_modinfo(void *modinfo, unsigned long modinfo_len, ...@@ -743,11 +744,10 @@ static char *get_next_modinfo(void *modinfo, unsigned long modinfo_len,
return NULL; return NULL;
} }
static char *get_modinfo(void *modinfo, unsigned long modinfo_len, static char *get_modinfo(struct elf_info *info, const char *tag)
const char *tag)
{ {
return get_next_modinfo(modinfo, modinfo_len, tag, NULL); return get_next_modinfo(info, tag, NULL);
} }
/** /**
...@@ -1951,7 +1951,7 @@ static void read_symbols(char *modname) ...@@ -1951,7 +1951,7 @@ static void read_symbols(char *modname)
mod->skip = 1; mod->skip = 1;
} }
license = get_modinfo(info.modinfo, info.modinfo_len, "license"); license = get_modinfo(&info, "license");
if (!license && !is_vmlinux(modname)) if (!license && !is_vmlinux(modname))
warn("modpost: missing MODULE_LICENSE() in %s\n" warn("modpost: missing MODULE_LICENSE() in %s\n"
"see include/linux/module.h for " "see include/linux/module.h for "
...@@ -1963,8 +1963,7 @@ static void read_symbols(char *modname) ...@@ -1963,8 +1963,7 @@ static void read_symbols(char *modname)
mod->gpl_compatible = 0; mod->gpl_compatible = 0;
break; break;
} }
license = get_next_modinfo(info.modinfo, info.modinfo_len, license = get_next_modinfo(&info, "license", license);
"license", license);
} }
for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
...@@ -1977,7 +1976,7 @@ static void read_symbols(char *modname) ...@@ -1977,7 +1976,7 @@ static void read_symbols(char *modname)
(is_vmlinux(modname) && vmlinux_section_warnings)) (is_vmlinux(modname) && vmlinux_section_warnings))
check_sec_ref(mod, modname, &info); check_sec_ref(mod, modname, &info);
version = get_modinfo(info.modinfo, info.modinfo_len, "version"); version = get_modinfo(&info, "version");
if (version) if (version)
maybe_frob_rcs_version(modname, version, info.modinfo, maybe_frob_rcs_version(modname, version, info.modinfo,
version - (char *)info.hdr); version - (char *)info.hdr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment