From: Sam Ravnborg Date: Mon, 26 Feb 2007 18:46:52 +0000 (+0100) Subject: kbuild: fix segmentation fault in modpost X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a61b2dfd1823506dbf1f9b046e0b09237ec1b985;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git kbuild: fix segmentation fault in modpost If modpost was called manually with filenames without '/' then modpost would segfault. Signed-off-by: Sam Ravnborg --- diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index e1f2b31cf34b..281abb77e033 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -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");