aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Robinson <andr345@gmail.com>2009-10-04 17:00:43 +0200
committerAndreas Robinson <andr345@gmail.com>2009-10-04 17:12:45 +0200
commitd7a8758609dc13d048a249295c2dcc4345cbf40f (patch)
tree1c29b71d525c3e2d3c59949f3154909d4201695d
parentb8fef87bd628dfaf0f1e43420be1ed4e49f9d35b (diff)
downloadmodule-init-tools-d7a8758609dc13d048a249295c2dcc4345cbf40f.tar.gz
elfops: remove errfn_t from load_strings
Commit 528db92ab1dd0d75dba415b9f3dc81f5a34773ce added an errfn_t parameter to elfops_core.c:load_strings. This was for the purpose of detecting missing terminators at the end of ELF-sections with strings in them, such as .modinfo. However, the committer (that'd be me) forgot to add any actual code to load_strings() and now the errfn_t parameter complicates the error handling when softdep is used. This commit removes that parameter and adds a non-fatal warning message. Signed-off-by: Andreas Robinson <andr345@gmail.com>
-rw-r--r--depmod.c8
-rw-r--r--elfops.h2
-rw-r--r--elfops_core.c11
-rw-r--r--modinfo.c2
-rw-r--r--modprobe.c2
5 files changed, 14 insertions, 11 deletions
diff --git a/depmod.c b/depmod.c
index 5b90b3a..1724d94 100644
--- a/depmod.c
+++ b/depmod.c
@@ -876,13 +876,13 @@ static int output_aliases(struct module *modules, FILE *out, char *dirname)
filename2modname(modname, i->pathname);
/* Grab from old-style .modalias section. */
- tbl = file->ops->load_strings(file, ".modalias", NULL, fatal);
+ tbl = file->ops->load_strings(file, ".modalias", NULL);
for (j = 0; tbl && j < tbl->cnt; j++)
fprintf(out, "alias %s %s\n", tbl->str[j], modname);
strtbl_free(tbl);
/* Grab from new-style .modinfo section. */
- tbl = file->ops->load_strings(file, ".modinfo", NULL, fatal);
+ tbl = file->ops->load_strings(file, ".modinfo", NULL);
for (j = 0; tbl && j < tbl->cnt; j++) {
const char *p = tbl->str[j];
if (strstarts(p, "alias="))
@@ -913,7 +913,7 @@ static int output_aliases_bin(struct module *modules, FILE *out, char *dirname)
filename2modname(modname, i->pathname);
/* Grab from old-style .modalias section. */
- tbl = file->ops->load_strings(file, ".modalias", NULL, fatal);
+ tbl = file->ops->load_strings(file, ".modalias", NULL);
for (j = 0; tbl && j < tbl->cnt; j++) {
alias = NOFAIL(strdup(tbl->str[j]));
underscores(alias);
@@ -926,7 +926,7 @@ static int output_aliases_bin(struct module *modules, FILE *out, char *dirname)
strtbl_free(tbl);
/* Grab from new-style .modinfo section. */
- tbl = file->ops->load_strings(file, ".modinfo", NULL, fatal);
+ tbl = file->ops->load_strings(file, ".modinfo", NULL);
for (j = 0; tbl && j < tbl->cnt; j++) {
const char *p = tbl->str[j];
if (strstarts(p, "alias=")) {
diff --git a/elfops.h b/elfops.h
index 0fb5167..ceee2c8 100644
--- a/elfops.h
+++ b/elfops.h
@@ -63,7 +63,7 @@ struct module_ops
void *(*load_section)(struct elf_file *module,
const char *secname, unsigned long *secsize);
struct string_table *(*load_strings)(struct elf_file *module,
- const char *secname, struct string_table *tbl, errfn_t error);
+ const char *secname, struct string_table *tbl);
struct string_table *(*load_symbols)(struct elf_file *module,
uint64_t **versions);
struct string_table *(*load_dep_syms)(struct elf_file *module,
diff --git a/elfops_core.c b/elfops_core.c
index 1495f68..58a7943 100644
--- a/elfops_core.c
+++ b/elfops_core.c
@@ -80,14 +80,18 @@ static void *PERBIT(load_section)(struct elf_file *module,
static struct string_table *PERBIT(load_strings)(struct elf_file *module,
const char *secname,
- struct string_table *tbl,
- errfn_t error)
+ struct string_table *tbl)
{
unsigned long size;
const char *strings;
strings = PERBIT(load_section)(module, secname, &size);
if (strings) {
+ if (strings[size-1] != 0) {
+ warn("%s may be corrupt; an unterminated string"
+ " was found at the end of section %s\n",
+ module->pathname, secname);
+ }
/* Skip any zero padding. */
while (!strings[0]) {
strings++;
@@ -147,8 +151,7 @@ static struct string_table *PERBIT(load_symbols)(struct elf_file *module,
return symtbl;
}
fallback:
- return PERBIT(load_strings)(module, "__ksymtab_strings", symtbl,
- fatal);
+ return PERBIT(load_strings)(module, "__ksymtab_strings", symtbl);
}
static char *PERBIT(get_aliases)(struct elf_file *module, unsigned long *size)
diff --git a/modinfo.c b/modinfo.c
index c2d733f..90e9ad3 100644
--- a/modinfo.c
+++ b/modinfo.c
@@ -307,7 +307,7 @@ int main(int argc, char *argv[])
ret = 1;
continue;
}
- tags = mod->ops->load_strings(mod, ".modinfo", NULL, error);
+ tags = mod->ops->load_strings(mod, ".modinfo", NULL);
if (!tags) {
release_elf_file(mod);
continue;
diff --git a/modprobe.c b/modprobe.c
index 4448dbc..6ce3ad0 100644
--- a/modprobe.c
+++ b/modprobe.c
@@ -345,7 +345,7 @@ static void clear_magic(struct elf_file *module)
module->ops->strip_section(module, "__vermagic");
/* New-style: in .modinfo section */
- tbl = module->ops->load_strings(module, ".modinfo", NULL, fatal);
+ tbl = module->ops->load_strings(module, ".modinfo", NULL);
for (j = 0; tbl && j < tbl->cnt; j++) {
const char *p = tbl->str[j];
if (strstarts(p, "vermagic=")) {