summaryrefslogtreecommitdiffstats
path: root/sys/boot/common/load_elf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/boot/common/load_elf.c')
-rw-r--r--sys/boot/common/load_elf.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/boot/common/load_elf.c b/sys/boot/common/load_elf.c
index e0d5821..e63d85e 100644
--- a/sys/boot/common/load_elf.c
+++ b/sys/boot/common/load_elf.c
@@ -570,17 +570,18 @@ elf_parse_modmetadata(struct preloaded_file *fp, elf_file_t ef)
{
struct mod_metadata md;
Elf_Sym sym;
- char *s, *v, **p;
- long entries;
+ char *s, *v, **p, **p_stop;
int modcnt;
- if (elf_lookup_symbol(fp, ef, "modmetadata_set", &sym) != 0)
+ if (elf_lookup_symbol(fp, ef, "__start_set_modmetadata_set", &sym) != 0)
return ENOENT;
- COPYOUT(sym.st_value + ef->off, &entries, sizeof(entries));
+ p = (char **)(sym.st_value + ef->off);
+ if (elf_lookup_symbol(fp, ef, "__stop_set_modmetadata_set", &sym) != 0)
+ return ENOENT;
+ p_stop = (char **)(sym.st_value + ef->off);
modcnt = 0;
- p = (char **)(sym.st_value + ef->off + sizeof(entries));
- while (entries--) {
+ while (p < p_stop) {
COPYOUT(p++, &v, sizeof(v));
COPYOUT(v + ef->off, &md, sizeof(md));
switch(md.md_type) {
OpenPOWER on IntegriCloud