mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-26 04:35:01 +00:00
kbuild: fix segmentation fault in modpost
If modpost was called manually with filenames without '/' then modpost would segfault. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
This commit is contained in:
parent
9bf8cb9b79
commit
a61b2dfd18
@ -1345,6 +1345,7 @@ static void add_depends(struct buffer *b, struct module *mod,
|
|||||||
buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n");
|
buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n");
|
||||||
buf_printf(b, "\"depends=");
|
buf_printf(b, "\"depends=");
|
||||||
for (s = mod->unres; s; s = s->next) {
|
for (s = mod->unres; s; s = s->next) {
|
||||||
|
const char *p;
|
||||||
if (!s->module)
|
if (!s->module)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -1352,8 +1353,11 @@ static void add_depends(struct buffer *b, struct module *mod,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
s->module->seen = 1;
|
s->module->seen = 1;
|
||||||
buf_printf(b, "%s%s", first ? "" : ",",
|
if ((p = strrchr(s->module->name, '/')) != NULL)
|
||||||
strrchr(s->module->name, '/') + 1);
|
p++;
|
||||||
|
else
|
||||||
|
p = s->module->name;
|
||||||
|
buf_printf(b, "%s%s", first ? "" : ",", p);
|
||||||
first = 0;
|
first = 0;
|
||||||
}
|
}
|
||||||
buf_printf(b, "\";\n");
|
buf_printf(b, "\";\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user