提交 a61b2dfd 编写于 作者: S Sam Ravnborg

kbuild: fix segmentation fault in modpost

If modpost was called manually with filenames without '/'
then modpost would segfault.
Signed-off-by: NSam Ravnborg <sam@ravnborg.org>
上级 9bf8cb9b
......@@ -1345,6 +1345,7 @@ static void add_depends(struct buffer *b, struct module *mod,
buf_printf(b, "__attribute__((section(\".modinfo\"))) =\n");
buf_printf(b, "\"depends=");
for (s = mod->unres; s; s = s->next) {
const char *p;
if (!s->module)
continue;
......@@ -1352,8 +1353,11 @@ static void add_depends(struct buffer *b, struct module *mod,
continue;
s->module->seen = 1;
buf_printf(b, "%s%s", first ? "" : ",",
strrchr(s->module->name, '/') + 1);
if ((p = strrchr(s->module->name, '/')) != NULL)
p++;
else
p = s->module->name;
buf_printf(b, "%s%s", first ? "" : ",", p);
first = 0;
}
buf_printf(b, "\";\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册