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 e63d85e..0eddbb4 100644
--- a/sys/boot/common/load_elf.c
+++ b/sys/boot/common/load_elf.c
@@ -540,7 +540,8 @@ static char invalid_name[] = "bad";
char *
fake_modname(const char *name)
{
- char *sp, *ep;
+ const char *sp, *ep;
+ char *fp;
size_t len;
sp = strrchr(name, '/');
@@ -557,12 +558,12 @@ fake_modname(const char *name)
} else
ep = name + strlen(name);
len = ep - sp;
- ep = malloc(len + 1);
- if (ep == NULL)
+ fp = malloc(len + 1);
+ if (fp == NULL)
return NULL;
- memcpy(ep, sp, len);
- ep[len] = '\0';
- return ep;
+ memcpy(fp, sp, len);
+ fp[len] = '\0';
+ return fp;
}
int
OpenPOWER on IntegriCloud